我有这两条规则:
RewriteCond %{HTTP_USER_AGENT} iPhone [NC]
RewriteRule ^categories$ home.php?categories=1[L,NC,PT,R=301]
RewriteRule ^featured$ home.php?featurez=1 [L,NC,PT,R=301]
问题在于,类别工作并且功能不起作用。 工作原理:
http://apps.com/iphone/categories
不起作用:
http://apps.com/iphone/featured
不起作用的第二条规则将我送到这里
http://apps.com/var/www/vhosts/apps.com/httpdocs/iphone/home.php?featurez=1
它似乎向我发送了我的目录根目录的根,并且整个事情都以我的网站的根为前缀。为什么?
怎么可能。
答案 0 :(得分:1)
我已在your previous question中使用其中任何一种解决方案解决此问题,这将修复重定向中出现的文件路径。
RewriteBase /iphone/
RewriteCond %{HTTP_USER_AGENT} iPhone [NC]
RewriteRule ^categories$ home.php?categories=1[L,NC,PT,R=301]
RewriteCond %{HTTP_USER_AGENT} iPhone [NC]
RewriteRule ^featured$ home.php?featurez=1 [L,NC,PT,R=301]
或
RewriteCond %{HTTP_USER_AGENT} iPhone [NC]
RewriteRule ^categories$ /iphone/home.php?categories=1[L,NC,PT,R=301]
RewriteCond %{HTTP_USER_AGENT} iPhone [NC]
RewriteRule ^featured$ /iphone/home.php?featurez=1 [L,NC,PT,R=301]