ZF .htaccess中怎么怎么去除固定的index.php

WBOY
發布: 2016-06-13 13:37:48
原創
789 人瀏覽過

ZF .htaccess中如何如何去除固定的index.php
现在文件的结构与官方的一样。
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都已经改了。

请大家 给点提示,我在这里阻拦了很久。。。。。。。。


------解决方案--------------------
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

应该差不多吧
------解决方案--------------------
你只要在url中不加index.php不就去掉了。
------解决方案--------------------
zend framework给出的.htaccess

PHP code


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
<br><font color="#e78608">------解决方案--------------------</font><br>
重启apache没 <div class="clear">
                 
              
              
        
            </div>
登入後複製
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!