Tutorial - How to redirect your website to its mobile version and vice versa using htaccess | Vevioz Community

Tutorial How to redirect your website to its mobile version and vice versa using htaccess

DevOps

Linux Systems Engineer
Joined
Oct 18, 2019
Messages
166
Reaction score
14
Points
18
Location
Indonesia
Website
addons.vevioz.com
Offline
Use the code 1:
Code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} (iphone|ipad|android|blackberry|windows\ phone) [NC]
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^ http://m.example.com

And code 2:
Code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !(iphone|ipad|android|blackberry|windows\ phone) [NC]
RewriteCond %{HTTP_HOST} ^m\.example\.com$ [NC]
RewriteRule ^ http://www.example.com

And code 3:
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301,NC]
RewriteCond %{HTTP_USER_AGENT} (iphone|ipad|android|blackberry|windows\ phone) [NC]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^ http://m.domain.com

301 redirects

Capture.PNG
 
Top Bottom