【问题标题】:Remove index.php from url on apache 2.4.6 on zend framework从 zend 框架上 apache 2.4.6 的 url 中删除 index.php
【发布时间】:2015-07-26 03:19:03
【问题描述】:

我在 zend 框架 1 中有一个项目,其中 google 用 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似乎没有包含在此表达式中。

有人知道解决办法吗?

【问题讨论】:

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


【解决方案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]

【讨论】:

  • OP 想要重定向旧链接。
  • 这并不能帮助我以任何方式重定向链接。正如我所说,该规则在将 Apache 升级到 2.4.6 之前有效,但在那之后就没有了。
猜你喜欢
  • 2012-12-30
  • 2014-10-10
  • 1970-01-01
  • 2012-12-22
  • 1970-01-01
  • 2013-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多