Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes #14862 -- Broken links when visiting pages ending in /index/

  • Loading branch information...
commit 4207cf665d2d399e9a193e38949f74c403012400 1 parent 74eab7e
Justin Abrahms justinabrahms authored
Showing with 8 additions and 0 deletions.
  1. +4 −0 django_website/docs/views.py
  2. +4 −0 django_website/urls/docs.py
4 django_website/docs/views.py
View
@@ -3,6 +3,7 @@
import datetime
import django.views.static
from django.core import urlresolvers
+from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.utils import simplejson
@@ -58,6 +59,9 @@ def objects_inventory(request, lang, version):
response['Content-Type'] = "text/plain"
return response
+def redirect_index(request, *args, **kwargs):
+ return HttpResponseRedirect(request.path.rstrip('index/'))
+
def search(request, lang, version):
docroot = get_doc_root_or_404(lang, version)
4 django_website/urls/docs.py
View
@@ -36,6 +36,10 @@
views.source,
),
url(
+ r'^(.*)/index/$',
+ views.redirect_index,
+ ),
+ url(
r'^(?P<lang>[a-z-]+)/(?P<version>[\w.-]+)/(?P<url>[\w./-]*)/$',
views.document,
name = 'document-detail',
Please sign in to comment.
Something went wrong with that request. Please try again.