首页 > apache用rewrite重写url时出现问题

apache用rewrite重写url时出现问题

在用ThinkPHP框架做开发时,用apache的rewrite来隐藏url里入口文件index.php,在windows下一切正常,但是到了ubuntu下,其他的都正常,只有请求地址后边是index时会出现404 not found错误,比如访问localhost/tpapp/login,能够正常重写为localhost/tpapp/index.php/login,但是访问localhost/tpapp/index却会出现404错误

看了apache的错误日志,提示是这样的,

Negotiation: discovered file(s) matching request:
 /var/www/tptest/index (None could be negotiated).

,貌似是说找到多个可能的路径,无法决定是哪个?

.htaccess文件内容如下

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

从结果来看,重写规则没有执行,因为如果执行了到话会被路由到Xx模块下的index方法,而不是出现404 not found。
我的问题跟这位仁兄(http://.com/q/10100000001...)的是一样的,但是下边的解决方法不适合我..
求大神解答!弄了一下午了还没搞懂,虽然可以避免用index,但总觉得这里有点迷糊。

【热门文章】
【热门文章】