Htaccess问题

时间:2012-12-14 00:14:32

标签: .htaccess

这是我目前的htaccess脚本

 RewriteEngine On 
 RewriteCond %{REQUEST_METHOD} ^TRACE 
 RewriteRule .* - [F]

 RewriteBase /

 RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
 RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

 RewriteRule ^home$ /index.php?hook=home [NC]

但是当我添加$ _GET变量时会出现问题,例如:

www.domain.com/home&showPoll=1

输出:

Not Found

The requested URL /home&showPoll=1 was not found on this server.

有没有办法解决它?感谢

1 个答案:

答案 0 :(得分:0)

www.domain.com/home&showPoll=1不是GET变量,因为您错过了?。通常,您可以只包含QSA以包含现有查询字符串:

RewriteRule ^home$ /index.php?hook=home [NC,QSA]

但如果您的网址确实缺少?,那么您可以尝试使用分组解析该部分:

RewriteRule ^home&?(.*)$ /index.php?hook=home&$1 [NC]