You must do this at the web server level (e.g. using mod_rewrite in Apache) or using middleware (e.g. this snippet )
Also see this SO question
Update: after your comment, I thought about it a little more. I liked Karl Meyer's answer, but then I realized that he would not process {% url%} in the reverse order. So here is what I will do:
Multiple sites: You need to use the Django site structure . This means creating site instances for each language using the Django admin.
A few settings: Each language site will also have its own settings.py. The only differences between each site will be the SITE_ID and ROOT_URLCONF , therefore, to follow the DRY principle, you must save the general settings in another file and import them into the main file as follows:
# settings_fr.py SITE_ID = 1 ROOT_URLCONF = 'app.urls_fr' from settings_common import *
... etc.
Multiple Conf URLs: As stated above, the URL for each site:
# urls_fr.py urlpatterns = patterns('', url(r'^Livres/$', books_view, name="books"), )
... etc.
Thus, the name of the URL (in this example, “books”) is the same for all languages, so {% url books %} will be formatted correctly, and the domain name will be the domain_name field of the site object with SITE_ID .
Multiple instances of the web server:. For each SITE to work correctly, each of them needs its own server instances. For apache + mod_wsgi, this means a different wsgi application for each SITE, for example:
# site_fr.wsgi import os, sys, django.core.handlers.wsgi os.environ['DJANGO_SETTINGS_MODULE'] = 'app.settings_fr' application = django.core.handlers.wsgi.WSGIHandler()
... etc. together with the corresponding apache virtual host for each site:
<VirtualHost *:80> ServerName mybooks.fr WSGIScriptAlias / /path/to/site_fr.wsgi ... </VirtualHost>
Hope this is clear :)