2012-03-09 91 views
0

注意到Apache的奇怪行爲。 我使用mod_rewrite每爲什麼Apache將.php添加到URI

RewriteCond %{REQUEST_URI} !^.*css|gif|js|png$ 
RewriteRule ^(.*)$ index.php?q=$1 [QSA] 

重定向所以當我鍵入 www.example.com/something

在瀏覽器

,裏面的index.php $ _REQUEST [ 'Q']回報 '東西'

但是除了index.php,還有一些其他的php文件在根文件夾(例如profile.php)中。

所以,當我鍵入

www.example.com/profile 

的index.php $ _REQUEST [ 'Q']返回 'profile.php'

爲什麼這個.PHP裏面出現?

回答

3

我的猜測是MultiViews已啓用。嘗試通過添加以下內容來禁用它:

Options -MultiViews 

到您的.htaccess文件。

+0

謝謝,這個工程。 – 2012-03-09 16:33:04

相關問題