diff --git a/django/contrib/flatpages/middleware.py b/django/contrib/flatpages/middleware.py index 231b5fdd5c..fb98c39a9e 100644 --- a/django/contrib/flatpages/middleware.py +++ b/django/contrib/flatpages/middleware.py @@ -7,7 +7,7 @@ class FlatpageFallbackMiddleware(object): if response.status_code != 404: return response # No need to check for a flatpage for non-404 responses. try: - return flatpage(request, request.path) + return flatpage(request, request.path_info) # Return the original response if any errors happened. Because this # is a middleware, we can't assume the errors will be caught elsewhere. except Http404: diff --git a/django/contrib/flatpages/views.py b/django/contrib/flatpages/views.py index 0517fc44d6..37d12c93a3 100644 --- a/django/contrib/flatpages/views.py +++ b/django/contrib/flatpages/views.py @@ -20,7 +20,7 @@ def flatpage(request, url): `flatpages.flatpages` object """ if not url.endswith('/') and settings.APPEND_SLASH: - return HttpResponseRedirect(url + "/") + return HttpResponseRedirect("%s/" % request.path) if not url.startswith('/'): url = "/" + url f = get_object_or_404(FlatPage, url__exact=url, sites__id__exact=settings.SITE_ID)