Let's say i have one page website and it has two versions, one simple html file for desktops and one Google's AMP version for mobiles. How can i redirect to AMP version? Thanks
Asked
Active
Viewed 2,384 times
1 Answers
2
Assuming your amp version is under /amp (http://example.com/amp), you can try redirecting your visitors in your .htaccess file like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !/amp$ [NC]
RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot\-mobile|iemobile|iphone|ipod|\#opera\ mobile|palmos|webos) [NC]
RewriteRule ^([a-zA-Z0-9-]+)([\/]*)$ https://example.com/$1/amp [L,R=302]

Alphacoder
- 299
- 2
- 10