为什么modRewrite将自动.php应用于这个简单的规则?

时间:2009-03-01 17:18:22

标签: apache .htaccess mod-rewrite

好吧,伙计们,我可能有一个愚蠢的问题,但我可能很愚蠢:)

我有这个简单的.htaccess:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteRule ^news/([^/]+)$               news-inside.php?n=$1 [L]
RewriteRule ^news/?$                  news.php [L]


RewriteCond %{REQUEST_FILENAME} !-f

每当我尝试通过键入一些这样的网址来进入第一个规则时:

http://host/news/something

我被重定向到news.php文件,而不是带有查询字符串的news-inside.php!

查看到达页面的$ _GET和$ _SERVER,结果如下:

$_GET => empty

$_SERVER (some)

  'REQUEST_METHOD' => string 'GET' (length=3)
  'QUERY_STRING' => string '' (length=0)
  'REQUEST_URI' => string '/news/something' (length=15)
  'SCRIPT_NAME' => string '/news.php' (length=9)
  'PATH_INFO' => string '/something' (length=10)
  'PATH_TRANSLATED' => string '/var/www/rolo/something' (length=23)
  'PHP_SELF' => string '/news.php/something' (length=19)

任何想法??

1 个答案:

答案 0 :(得分:5)

尝试停用MultiViews

Options -MultiViews