首页 文章

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

提问于
浏览
0
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 回答

  • 2

    尝试在htaccess中禁用MultiViews:

    Options -MultiViews
    

相关问题