I have a webshop, and since google decided to promote mobile versions of webpages, I am developing my m.example.com
.
Here are the trick. I do not want, m.
domain. What I want is, when a user is coming, I check the user agent, and if it is coming from mobile, I will show the mobile version, if come from desktop, show the desktop version.
But, I want to use exactly the same urls to the users. So, the http://example.com/contact/
will be the url for both desktop users, and both mobile users.
The mobile version of the page is under a subdirectory ./mobile/
.
Is it possible somehow to force apache, to change document root, if someone is coming from mobile, but keep the original URLS?
For example:
http://example.com/contact/
should run /var/apache/example.com/mobile/contact.php
, but for desktop version, should run /var/apache/example.com/contact.php
? As I mentioned, the URLs are the same.
If the question is not clear, please leave a comment.