1

我正在尝试从 URL 中删除 index.php,该 URL 与 EZPublish 站点上的 .htaccess 示例和 ForceVirtualHost=true 一起使用。问题是指向 index.php 的旧链接不再有效(从搜索引擎链接时会出现问题)。

我试图在.htaccess 中使用重写规则来解决这个问题,但我无法让它工作。我的一些尝试是:

尝试 1

RewriteCond %{REQUEST_URI} ^/index.php
RewriteRule ^index\.php(.*) http://www.mysite.com$1

RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule .* index.php [L]

此尝试会导致无限循环。

尝试 2

RewriteCond %{REQUEST_URI} ^/(index\.php)?(.*)$
RewriteRule %2 index.php [L]

RewriteRule .* index.php [L]

也不起作用:-(。

注意。'RewriteRule .* index.php [L]' 是使 EZPublish 中的虚拟主机设置工作所必需的。

任何帮助将不胜感激。

薇薇安

4

2 回答 2

1

在您的设置/覆盖/site.ini.append.php 中:

 [SiteAccessSettings]
 ForceVirtualHost=true
于 2011-01-05T00:08:46.447 回答
0

尝试检查请求行

RewriteCond %{THE_REQUEST} ^GET\ /index\.php
RewriteRule ^index\.php/?([^/].*)?$ /$1 [L,R=301]

RewriteRule !^index\.php$ index.php [L]
于 2009-10-10T10:58:29.377 回答