#mymiddleware.py class RedirectToNoSlash(object): def process_request(self,request): if '/admin' not in request.path and request.path != '/': if request.path[-1] == '/': return HttpResponsePermanentRedirect(request.path[:-1]) #settings.py MIDDLEWARE_CLASSES = ( 'mymiddleware.RedirectToNoSlash', ... ) #Make sure its the first middleware, or its before any url manipulating middleware such as CommonMiddleware.