How can I redirect traffic that doesn't match any of my other URLs back to the home page?
urls.py:
urlpatterns = patterns('',
url(r'^$', 'macmonster.views.home'),
#url(r'^macmon_home$', 'macmonster.views.home'),
url(r'^macmon_output/$', 'macmonster.views.output'),
url(r'^macmon_about/$', 'macmonster.views.about'),
url(r'^.*$', 'macmonster.views.home'),
)
As it stands, the last entry sends all "other" traffic to the home page but I want to redirect via either an HTTP 301 or 302.
See Question&Answers more detail:os