1

我在启用多视图以在整个站点中全局删除文件扩展名 .php 时遇到问题,这工作正常。

但是现在,并不是所有的 301 重定向都有效。我们有很多旧的入站(优质)链接需要转到这些新网址,有些需要转到全新的网址。

在 htaccess 文件中,这有效:

Redirect 301 /files/Menu.pdf http://www.example.co.uk

这可行,但是 URL 的跟踪被添加到重定向的 url 上:

Redirect 301 /section.php/11/1/life-drawing http://www.example.co.uk

这不起作用:

Redirect 301 /section/116/1/drawings http://www.example.co.uk

以下是 htaccess 文件的内容:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.co.uk [NC]
RewriteRule ^(.*)$ http://www.example.co.uk/$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.co.uk/ [R=301,L]

RewriteEngine on
Options +SymlinksIfOwnerMatch +MultiViews
RewriteRule ^(.*).php/(.*) $1.php?$2

Redirect 301 /files/Menu.pdf http://www.example.co.uk
Redirect 301 /section.php/11/1/life-drawing http://www.example.co.uk
Redirect 301 /section/116/1/drawings http://www.example.co.uk

试过这个,也没有运气:

RewriteRule ^section/101/1/example-here$ http://www.example.com/ [R=301,L]

任何帮助将不胜感激。

4

0 回答 0