How to redirect the site to m.example.com

How to redirect the site to m.example.com when you are running the site on mobile device -

#‪#‎BEGIN‬ MOBILE (do not edit below this line)
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ((.*iPhone.*)|(.*iPod.*)|(.*BlackBerry.*)|(.*Android.*Mobile.*)|(.*Windows\ CE.*)|(.*IEMobile.*)|(.*Opera\ Mini.*)|(.*Opera\ Mobi.*))
RewriteCond %{HTTP_COOKIE} !dm_show_classic
RewriteCond %{QUERY_STRING} !no_redirect=true [NC]
RewriteCond %{HTTP_HOST} ^www\. [NC,OR]
RewriteCond %{HTTP_HOST} ^[0-9a-z-]+\.[a-z]+$ [NC]
RewriteCond %{REQUEST_URI} ^/_dm/s/ [NC,OR]
RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|png|css|js|txt|ico|pdf|bmp|tif|mp3|wav|wma|asf|mp4|flv|mpg|avi|csv|doc|docx|xls|xlsx|ppt|pptx|zip|rar|tar|gz|dmg|iso)$ [NC]
RewriteBase /
RewriteRule ^(.*)$ http://m.example.com/ [R,L]
#‪#‎END‬ MOBILE

No comments:

Post a Comment