本文介绍了我如何重定向到移动版网站的AMP版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个页面网站,它有两个版本,一个用于桌面的简单html文件和一个用于手机的Google AMP版本。我如何重定向到AMP版本?谢谢 解析方案
假设你的放大器版本在/ amp( example/amp ),,您可以尝试像下面这样在您的.htaccess文件中重定向访问者:
RewriteEngine On RewriteCond%{REQUEST_URI}!/ amp $ [NC] RewriteCond%{HTTP_USER_AGENT}(android | blackberry | googlebot\-mobile | [移动| iphone | ipod | \#opera \ mobile | palmos | webos)[NC] RewriteRule ^([a-zA-Z0-9 - ] +)([\ /] *)$ example/$1/amp [L,R = 302]
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
解决方案Assuming your amp version is under /amp (example/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-]+)([\/]*)$ example/$1/amp [L,R=302]
更多推荐
我如何重定向到移动版网站的AMP版本?
发布评论