[wp-hackers] Two URLs - One WP Install? (And the silly way WordPress stores full URLs in the database)

Robert Lusby nanogwp at gmail.com
Thu May 17 10:05:27 UTC 2012


Hello,

We're setting up a mobile version of a website we run. We decided to do 
this by creating a mobile specific template.

However we'd quite like to switch the URL to a mobile version of the site:

E.g.
-> normal visitor reaches the site, and stays at http://www.example.com
-> mobile visitor reaches the site, and gets redirected to 
http://m.example.com

Behind the scenes, the only difference between the two is the template 
picked. It's the same blog + DB.

I get how to do the template switching etc ... but how do I get 
WordPress to answer on http://m.example.com and stop redirecting all 
requests back to the www....?

Also, I now have to do a find and replace on ALL the urls in the 
database everytime the mobile site is loaded, for that site, to map to 
http://m.example.com ... Why does WordPress do this! Why not just keep 
the content as content! And let us decide what wrappers we want to put 
around it!

Cheers,
Rob.


More information about the wp-hackers mailing list