I have a subdomain m.example.com that I want to point to the same location as example.com/mobile running on an apache2/django1.3 installation.
example.com is the landing page, and I have the urls.py configured such that urls that match /^mobile$/ will be served the mobile version of the page. I looked into <VirtualHost>, but I think it requires a physical location for me to point m.example.com at and with the django urls there is no physical location except for the root of the project directory.
I am unsure if the configuration change is made on the apache side or the django side.
I’ve also looked into the mod_rewrite module for Apache, but I would prefer if I didnt have to redirect m.example.com to example.com/mobile
I will avoid apache redirections, just using Middlewares.
It’s common to use a middleware to get a context variable that gives the current domain that the user is using.
From: http://djangosnippets.org/snippets/1119/
on your view, can use the subdomain and domain value to properly switch content and logic.
You can even get decorators, and map all the views on your website.
Even more common, it’s just to build a second project, that use the same database. It’s up to you.