我有一个网站网址http://t8.example.info/home.html
我想在移动版中打开它时将此网址重定向到http://t8.example.info/index.php?id=802
。
我不希望在桌面版本中打开时重定向。它应该在桌面版本中打开。
需要快速帮助。 提前致谢
答案 0 :(得分:0)
不知道htaccess但你可以从javascript实现它
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
window.location = "http://t8.example.info/index.php?id=802";
}
答案 1 :(得分:0)
最后我发现了一个解决方案 我在.htaccess文件中使用下面的代码
RewriteCond %{REQUEST_URI} /home.html$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^/?(.*)$ http://t8.example.info/index.php?id=802 [L,R=302]