A very easy way to redirect users that visit your website from a mobile device to the mobile version of your website, is using your htaccess file. If your server is running on Apache, you can add the following code to your .htaccess file to get the job done:
1 2 3 4 | RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "iphone|ipod|android" [NC] RewriteCond %{HTTP_HOST} !^m.example.com RewriteRule ^(.*)$ http://m.example.com/ [L,R=302] |
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "iphone|ipod|android" [NC] RewriteCond %{HTTP_HOST} !^m.example.com RewriteRule ^(.*)$ http://m.example.com/ [L,R=302]
You can include other mobile browsers by adding other browser to the RewriteCond rule:
1 2 3 4 | RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] RewriteCond %{HTTP_HOST} !^m.example.com RewriteRule ^(.*)$ http://m.example.com/ [L,R=302] |
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] RewriteCond %{HTTP_HOST} !^m.example.com RewriteRule ^(.*)$ http://m.example.com/ [L,R=302]
Not registered? Create an Account.
Lost your password? Click here to recover.
Create, customize, and publish mobile web applications using the Appcropolis Mobile Builder.
Get StartedWe offer 1,000's of mobile templates that are fully designed, coded, and ready to use. Learn more.
Download Free Templates
Greetings! Very useful advice in this particular article! It's the little changes which will make the most significant changes. Many thanks for sharing!
Google Sites of interest we've a link to.
Google That may be the finish of this write-up. Right here youll uncover some web-sites that we believe you will appreciate, just click the links.
Google Just beneath, are many totally not connected web-sites to ours, nonetheless, they're certainly really worth going over.
Google Always a large fan of linking to bloggers that I like but do not get a lot of link enjoy from.
Google That is the end of this article. Here you will discover some web pages that we assume you will value, just click the links.
Google Here is an excellent Blog You might Come across Fascinating that we encourage you to visit.
Google Every when inside a even though we pick blogs that we read. Listed below are the most recent web-sites that we pick out.
Google Here is a superb Blog You may Find Exciting that we encourage you to visit.