PHP在发送表单时发出问题并启用了mod重写

时间:2014-09-02 23:59:39

标签: php .htaccess mod-rewrite

我有一个搜索功能来查找产品,我也在.htaccess

中启用了mod重写
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^([A-Za-z0-9_-]+)$ /index.php?go=$1
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?go=$1&action=$2
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?go=$1&action=$2&do=$3
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ /index.php?go=$1&action=$2&do=$3&id=$4

问题是当我进行https://www.server.com/search?search=try+search之类的搜索时,它在执行操作时不会显示任何结果:

echo $_GET['search'];

但如果我做https://www.server.com/?go=search&search=try+search那么它完美无缺,所以我看到问题是重写但我无法修复它。

有什么建议吗?

由于

1 个答案:

答案 0 :(得分:1)

尝试将此添加到每个规则:[QSA,L]

有关此处标记的详细信息:QSAL