从zend框架上的apache 2.4.6上的url中删除index.php

时间:2015-05-14 13:21:49

标签: php .htaccess mod-rewrite zend-framework apache2.4

我在zend框架1中有一个项目,其中谷歌索引链接http://www.example.com/index.php/url而不是http://www.example.com/url,从而产生重复和不需要的链接。

我在htaccess中有这个规则

 RewriteRule ^index\.php(.*)$ /$1 [R=301,QSA,L]

在我们将Apache升级到2.4.6之前一直运行良好,从那以后它只重定向了像www.example.com/index.phpurl这样的链接而不是www.example.com/index.php/url,index.php / url似乎没有包含在此表达式中。

有没有人知道这方面的解决方案?

1 个答案:

答案 0 :(得分:-1)

试试这个

RewriteEngine On
RewriteBase /myproject/

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(.+)$ index.php/$1 [L]
相关问题