Issue #6 resolved

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

Anonymous created an issue

If 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/ because the top page does not have any lang preferences on it.

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 to use HttpResponsePermanentRedirect instead like so:

$ 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)

Comments (1)

  1. Log in to comment