htaccess忽略/ index / path

时间:2011-12-29 23:47:17

标签: .htaccess url-rewriting bootstrapping

我正在为我公司的应用程序开发MVC框架,并使用.htaccess获取URL变量来管理我的引导程序的路由和变量。它在我的本地机器上运行得很好,通过WAMP运行最新的Apache ......

但是,在我的远程开发服务器上(运行相同版本的Apache).htaccess似乎忽略了对url.com/index/的请求,同时它仍然正确识别传递给其他路径的变量,例如url / blog /。

测试案例:

URL request:  http://url.com/index/login/
$_REQUEST['rt']: null

URL request:  http://url.com/index/blah/
$_REQUEST['rt']: null

URL request: http://url.com/blog/view
$_REQUEST['rt']: blog/view

URL request: http://url.com/red/blue/green/orange/
$_REQUEST['rt']: red/blue/green/orange/

在我的WAMP实例上,上面的第一个测试返回以下内容:

URL request:  http://url.com/index/login/
$_REQUEST['rt']: index/login

这是两台服务器上使用的.htaccess:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]

我已经多次重启浏览器,清除了浏览器的缓存,重新启动等等......似乎没有任何帮助。任何想法为什么会这样?

1 个答案:

答案 0 :(得分:2)

我发现问题是什么以及如何解决,这必须是你的htaccess的第一行:

Options -Indexes +FollowSymLinks -Multiviews

对我来说很好,欢呼声