rxmnnxfpvg
rxmnnxfpvg

Reputation: 31003

Django base url: example.com

How do I catch the following two urls in my urls.py?

example.com
example.com/

Right now I'm doing:

from django.conf.urls import patterns, url, include

urlprefix = 'websites.app'
urlpatterns = patterns(urlprefix,
        (r'index/$', 'public.views.index'), # landing page
        )

If I add:

        (r'$', 'public.views.index'), # landing page

as a catch-all, then it gets all rules. I just want it to go to index when there's a trailing slash or nothing past the base url.

Upvotes: 0

Views: 1205

Answers (1)

iMom0
iMom0

Reputation: 12921

(r'^$', 'public.views.index'), # landing page

and then set APPEND_SLASH true in settings.

Upvotes: 1

Related Questions