查询为'index'时,htaccess重定向无法正常工作

时间:2013-07-29 07:21:07

标签: apache .htaccess redirect rewrite

I am just learning mvc structure. In my mvc directory, 
I have a .htaccess file which contains this:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

The idea is to redirect all the requests to index.php like:
http://www.domain.com/mvc/test
will be
http://www.domain.com/mvc/index.php?url=test

It is working fine.

But when I am trying to pass this:
http://www.domain.com/mvc/index
hoping to be converted to
http://www.domain.com/mvc/index.php?url=index

But it is not working.

I’ve seen some tutorial videos where this works.
There must be some settings which I don’t know.

1 个答案:

答案 0 :(得分:2)

尝试在htaccess中禁用MultiView:

Options -MultiViews