htaccess mobile redirect


/ Published in: Apache
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #redirect mobile browsers
  2. RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
  3. RewriteRule ^(.*)$ http://m.example.com [R=301]
  4. RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
  5. RewriteRule ^(.*)$ http://m.example.com [R=301]
  6. RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$
  7. RewriteRule ^(.*)$ http://m.example.com [R=301]
  8. RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
  9. RewriteRule ^(.*)$ http://blackberry.example.com [R=301]
  10. RewriteCond %{HTTP_USER_AGENT} ^.*IEMobile.*$
  11. RewriteRule ^(.*)$ http://ie.example.com [R=301]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.