2012-06-25 101 views
1

好了,我已經包含此.htaccess文件這htaccess的mod_rewrite的難題

<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 i不合作。

另一個更新好了,所以它看起來像正在發生的事情是,當我做/指數/不管,它自動假定的index.php,而忽略的是,它自動添加.php爲它,當我不t想要它。任何想法如何阻止?

回答

1

問題解決:我需要將-MultiViews添加到httpd.conf文件中。