好的,所以我有这个包含这个的 .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 中, thep
和其他查询对象没有通过,但在 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/whatever 时,它会自动假定 index.php,并忽略它,当我不希望它时,它会自动将 .php 添加到其中。关于如何阻止它的任何想法?