嘿有StackOverflow社区,我搜索了很多关于stackoverflow来解决我的“太多重定向”错误。 但找不到任何有用的东西。我想通过.htaccess和UserAgent条件重定向到移动目录。发现高投票解决方案,看起来像这样:.htaccess将301重定向到移动目录 - 太多重定向错误
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile" [NC] RewriteRule ^(.*)$ http://mysite.com/mobile/$1 [R=301,L]
重定向本身的伟大工程,但它似乎是一个移动浏览器在一个循环中添加/移动这样的URL成长为像http://mysite.com/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile直到我得到一个错误“couldn由于重定向太多而无法打开网站“。
我的完整的.htaccess看起来是这样的:
AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile" [NC] RewriteRule ^(.*)$ http://mysite.com/mobile/$1 [R=301,L]
由于提前,卢卡斯铁托
发生过很多次。 htaccess可能位于http://mysite.com/mobile的某个文件夹内吗?这将是一个递归重定向。 – opalenzuela