Looking for help on deciding how to redirect users to a mobile optimized version of my site (m.mysite.com).
Looking at two methods:
- Server configuration (.htaccess or even varnish)
- Webapp (php)
The problem I see with #1 is with the "view full site" link on the mobile site. If a user clicks that link and they go to mysite.com won't the server just redirect them back to m.mysite.com?
For #2 I could create a cookie that is checked in addition to the user agent.
Any suggestions/comments? Is there a better way to "remember" if the user clicked "visit full site"?
RewriteCond %{HTTP_COOKIE} ...and build your logic around. Each approach is possible. #2 is easier but required PHP to get involved which is more "expensive" in terms of CPU/resources than mod_rewrite (although it should be absolutely fine on any modern hardware unless it is under heavy load and limited in resources). – LazyOne Jul 13 '11 at 11:27