ZF .htaccess中如何如何去除固定的index.php

qizhiping 2012-04-04 04:18:25
现在文件的结构与官方的一样。
public/index.php
application/controllers/indexController.php
现在我每次访问都要用到
localhost/test/public/index.php/index/index
,如何将这里的index.php用.htaccess去掉,
我现在的.htaccess文件内容如下:
RewriteEngine On

RewriteCond %{REQUEST_URI} ^index.php [OR]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
但是每次如果去掉index.php后页面就提示 找不到此页面。

我的apache中的三处AllowOverride All与LoadModule rewrite_module modules/mod_rewrite.so都已经改了。

请大家 给点提示,我在这里阻拦了很久。。。。。。。。
...全文
224 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
qizhiping 2012-04-08
  • 打赏
  • 举报
回复
这个问题不是apache的问题,我从别人的电脑复制了一份.htaccess,里面的内容一样,然后就可以了,然后我查看了文件的权限,是一样的。。。。。。。
还没找出到底是什么问题?
等待高人出现。。。。。
qizhiping 2012-04-08
  • 打赏
  • 举报
回复
重启过N次。。。
qiuye126 2012-04-08
  • 打赏
  • 举报
回复
重启apache没
coder 2012-04-05
  • 打赏
  • 举报
回复
zend framework给出的.htaccess


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

就可以了。不行,八成是apache的问题
qizhiping 2012-04-05
  • 打赏
  • 举报
回复
我用链接localhost/test/public/index.php/index/index/可以访问,
但用localhost/test/public/index/index 就不能访问。。。。。。
coder 2012-04-05
  • 打赏
  • 举报
回复
你只要在url中不加index.php不就去掉了。
qizhiping 2012-04-04
  • 打赏
  • 举报
回复
不是这个错误,会不会还需要配置什么信息??
RewriteEngine On


RewriteCond %{REQUEST_URI} ^index.php [OR]

RewriteCond %{SCRIPT_FILENAME} -s [OR]
RewriteCond %{SCRIPT_FILENAME} -l [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^(.*)$ - [NC,L]
RewriteRule ^(.*)$ index.php/$1 [NC,L]
xuzuning 2012-04-04
  • 打赏
  • 举报
回复
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

应该差不多吧
qizhiping 2012-04-04
  • 打赏
  • 举报
回复
烦啊,到底是哪里的问题????

4,250

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧