好的,所以我有这个包含这个.htaccess文件
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php?p=%{REQUEST_URI}&%{QUERY_STRING} [L] </IfModule>
问题是,在Apache 2.2.22中, p和其他查询对象没有通过,但它在apache 2.4.2中效果很好。
所以基本上在Apache 2.2.22它只是将所有内容转发到index.php,但它没有任何get对象。
任何帮助,谢谢。
更新
好,所以我改变了线路
RewriteRule . /index.php?p=%{REQUEST_URI}&%{QUERY_STRING} [L]
至
RewriteRule ^(.*) /index.php?p=$1 [L,QSA]现在在Apache 2.2.22 p GET不通过,但任何具体的查询,我添加通过。
所以,如果我这样做
http://localhost/index/fun/buns/funds?man=woman
在2.4.2我得到
array (size=2) 'p' => string 'index/fun/buns/funds' (length=20) 'man' => string 'woman' (length=5)
和2.2.22我得到
array(1) { ["man"]=> string(5) "woman" }
要清楚 2.4.2上发生了什么是我想要的,而2.2.22是不合作的。
另一个更新好吧,看来发生了什么事情是,当我做/索引/什么,它自动假设index.php,并忽略它,它会自动添加.php,当我不想要它。 任何想法如何阻止?
需要将add -MultiViews添加到httpd.conf文件中。