Using 301 instead of 302 when no lang is set in URL

6 views
Skip to first unread message

Iqbal Abdullah

unread,
Mar 17, 2010, 9:11:33 PM3/17/10
to django-multilingual
Ff we have a site that already has a reputation, putting django-
localeurl will redirect the top page to a different URL, i.e http://www.foo.bar
-> http://www.foo.bar/en/

From an SEO point of view in order to keep the reputation intact, it's
best that we use 301 instead of 302. I have made a simple change in
process_request() in the middleware.py file like so to enable this:

$ diff middleware.py middleware.py.new

3c3
< from django.http import HttpResponseRedirect
---
> from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
42c42,43
< return HttpResponseRedirect(locale_path)
---
> #return HttpResponseRedirect(locale_path)
> return HttpResponsePermanentRedirect(locale_path)

I've sent a proposal for this at:
http://bitbucket.org/carljm/django-localeurl/issue/6/using-301-instead-of-302-when-no-lang-is-set-in

Carl Meyer

unread,
Mar 19, 2010, 3:15:07 AM3/19/10
to django-multilingual
Thanks for reporting this; the switch to 301 status codes is included
in the new 1.4 release of django-localeurl.
Reply all
Reply to author
Forward
0 new messages