【发布时间】:2012-10-22 13:07:15
【问题描述】:
所以我们有一个开发站点,例如:test.domain.com/dev/filename.html 并且它已被 Google 索引,所以我需要将它们重定向到 www.newdomain.com/filename.html 而不仅仅是文件还有文件夹/文件之类的。
test.domain.com/dev/example/filename.html
或 www.newdomain.com/example/example/filename.html
到
www.newdomain.com/filename.html
注意,test 域上的 /dev/ 文件夹不能在重定向上推送?
有人对此有什么想法吗?
我试过了:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !test.domain.co.uk/dev/$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
经过一些测试后,它会重定向到http://www.newdomain.com/dev/page.html,我需要删除 /dev/ .....
还有一些其他的选择,同时到处寻找,但还没有满足要求。
提前致谢
【问题讨论】: