JonnoTheDev Posted March 10, 2010 Share Posted March 10, 2010 Need help with following rule. Crappy at mod-rewrite. Need to redirect users to a mobile version of a site if a mobile device is detected. The pages on both sites are identical, so if a user on an iPhone goes to www.foobar.com/test-123.php it will 301 redirect to mobile.foobar.com/test-123.php So far: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^.*(up.browser|up.link|windows\ ce|iPhone|Palm|BlackBerry|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp).*$ [NC] RewriteRule ^(.*)$ http://www.foobar.com [R=301] Obviously this just redirects to the root of the mobile domain. Need to redirect to the landing page. Quote Link to comment https://forums.phpfreaks.com/topic/194786-redirect-for-mobile-devices/ Share on other sites More sharing options...
JonnoTheDev Posted March 10, 2010 Author Share Posted March 10, 2010 Never mind, I think this should work. RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^.*(up.browser|up.link|windows\ ce|iPhone|Palm|BlackBerry|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp).*$ [NC] RewriteRule ^(.*)$ http://www.foobar.com%{REQUEST_URI} [R=301] Quote Link to comment https://forums.phpfreaks.com/topic/194786-redirect-for-mobile-devices/#findComment-1024306 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.