0
我试图做到这一点,当我从手机重新定向到手机网站,从PC意味着正常的网站。但条件不能正常工作。2个条件在相同的.htaccess文件中。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} "{android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile}" [NC]
RewriteRule ^(.*)$ http://localhost:8080/home.html [L,R=301]
RewriteCond %{HTTP_USER_AGENT} "!{android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile}" [NC]
RewriteRule ^abc.html$ /abc1.html [R=301,L]
RewriteRule ^1.html$ /2.html [R=301,L]
</IfModule>
当我从移动设备打本地主机我得到移动网站正常,但如果我给本地主机/ abc.html第二个条件进入画面,但它实际上应该去移动网站。代码的任何问题?
我有疑问,在过去的2个重写规则U表示不使用301重定向,这些页面不会退出这些只是为了保持旧的URL'为谷歌和书签的URL。你仍然认为301不是必需的。那么我什么时候需要301? – Hacker 2012-07-09 09:36:36
正是在这种情况下,您描述了:URI(不再存在)的位置,并且您希望传入浏览器知道新位置。 – TerryE 2012-07-11 11:46:37