Htaccess规则适用于在线检查程序,但不适用于野外检查程序

时间:2015-11-13 10:34:49

标签: .htaccess

我现在被.htaccess规则驱逐了便盆,而我却无法让它发挥作用。它看起来像这样:

RewriteEngine On
RewriteBase /

# Workaround for incorrect URL in email
RewriteCond %{REQUEST_URI} ^/used-cars/index.php$
RewriteCond %{QUERY_STRING} page=1
RewriteRule ^(.*) http://www.mysite.co.uk/used-cars/index.php?page=1&c=main&m=search&manufacturer=&model=&pricemin=&pricemax=&branch=&postcode=example&bodystyle=&maxage=&transmission=&fueltype=&colour=&co2=&rfl=&filter=managersspecials [R=301,L]

它应该转换此网址:

http://www.mysite.co.uk/used-cars/index.php?page=1

进入这个:

http://www.mysite.co.uk/used-cars/index.php?page=1&c=main&m=search&manufacturer=&model=&pricemin=&pricemax=&branch=&postcode=example&bodystyle=&maxage=&transmission=&fueltype=&colour=&co2=&rfl=&filter=managersspecials

它适用于http://htaccess.madewithlove.be/,但不适用于野外。知道为什么吗?显然,该测试人员不是100%准确,但我不能解释为什么它不工作。

1 个答案:

答案 0 :(得分:1)

试试这条规则:

RewriteEngine On

RewriteCond %{THE_REQUEST} /used-cars/index.php\?page=1 [NC]
RewriteRule ^ http://www.mysite.co.uk/used-cars/index.php?page=1&c=main&m=search&manufacturer=&model=&pricemin=&pricemax=&branch=&postcode=example&bodystyle=&maxage=&transmission=&fueltype=&colour=&co2=&rfl=&filter=managersspecials [QSA,NC,L,R]