我根据Plone 4改变了十年的URL
我在stackoverflow上阅读了有关Plone CMS问题的Redirect 301的所有内容,但我希望通过更简单的方式来修改我的虚拟主机并插入行
Redirect 301 old-url new-url
Redirect 301 old-url new-url
但我不知道在我的虚拟主机中插入此行的位置
我尝试不同的地方,但似乎无法正常工作
我的VirtualHost:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerSignature On
CustomLog /home/log/example.com-access.log combined
ErrorLog /home/log/example.com-error.log
LogLevel warn
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/icons/ - [L]
RewriteRule ^/(.*) \
http://localhost:8082/VirtualHostBase/http/%{SERVER_NAME}:80/example/VirtualHostRoot/$1 [L,P]
</IfModule>
<IfModule mod_proxy.c>
ProxyVia On
<LocationMatch "^[^/]">
Deny from all
</LocationMatch>
</IfModule>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<IfModule mod_disk_cache.c>
#CacheEnable disk /
</IfModule>
<IfModule mod_deflate.c>
</IfModule>
</VirtualHost>
想法是:
Redirect permanent http://www.example.com/old-url-xxx http://www.example.com/new-url-xxx
Redirect permanent http://www.example.com/old-url http://www.example.com/new-url
答案 0 :(得分:4)
立即高于现有的重写规则,添加如下规则:
RewriteRule ^/old-url(.*) http://www.example.com/new-url$1 [L,R=301]
通过匹配/old-url/
之后的路径部分(如果有)并将其放在重定向网址的末尾,重定向整个网址部分。