2

将域从 ExampleShop.com 更改为 ExampleStore.com

我在尝试重定向大约 30 个特定页面并为 URL 映射未仅更改域的页面执行通用重定向时遇到问题。

这就是我所拥有的,它使用通用重写规则重定向所有内容,而不是重定向特定的重写。

Options +FollowSymLinks
RewriteEngine on

#Specialty Rewrites for non-exact mapped URLs
RewriteRule ^/gifts/jewellery/bracelets.html$ http://www.ExampleStore.com/gifts/jewellery/bracelets.html [R=301,L]

RewriteRule ^/gifts/watches/banded.html$ http://www.ExampleStore.com/gifts-for-him/jewellery/watches.html [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#Generic Rewrite for exact mapped URLs
RewriteRule ^(.*)$ http://www.ExampleStore.com/$1 [R=301]
4

1 回答 1

1

删除前导斜杠:

RewriteRule ^gifts/jewellery/bracelets.html$ http://www.ExampleStore.com/gifts/jewellery/bracelets.html [R=301,L]

RewriteRule ^gifts/watches/banded.html$ http://www.ExampleStore.com/gifts-for-him/jewellery/watches.html [R=301,L]

.htaccess是每个目录指令,Apache 在RewriteRule.

于 2013-11-12T20:22:35.027 回答