无法在.htaccess中为长网址进行301域重定向

时间:2009-04-12 19:41:28

标签: .htaccess

我刚将siteA.com移至siteB.com。我正试图将siteA.com的流量提供给siteB.com。

我的.htaccess文件301重定向不起作用

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.siteA.com/home/3-Tips-in-Math.html$
RewriteRule ^/?$ "http://www.siteB.com/home/3-Tips-in-Math.html" [R=301,L]

如何使上述代码生效?

1 个答案:

答案 0 :(得分:1)

尝试此规则:

RewriteCond %{HTTP_HOST} !^www\.siteB\.example$
RewriteRule ^ http://www.siteB.example%{REQUEST_URI} [L,R=301]