3

我更像是一名程序员而不是服务器专家,因此非常感谢任何帮助!

出于 SEO 原因转发域名 ->
由第三方托管的 NewDomain.com 需要指向当前托管的站点 CurrentDomain.com。我知道我需要...

1) 专门调整NewDomain.com DNS A记录

  • 万维网。
  • @。
  • *。
  • FTP。
  • 邮件。

2) 调整 NewDomain.com DNS MX 记录

3) 添加 301 重定向到 CurrentDomain.com 托管的 .htaccess 文件,以便所有对 NewDomain 的请求都将转发到 CurrentDomain.com。

RewriteEngine On
RewriteCond %{HTTP_HOST} NewDomain.com$
RewriteRule ^(.*)$ http://CurrentDomain.com/$1 [R=301,L]

问题:
还需要做什么?
1)有什么遗漏吗?
2) 是否应该进行额外的 DNS 更改?如果有,在哪里?
3) 如果我不想将邮件发送到 NewDomain,MX 记录是否应该指向 mail.CurrentDomain.com?
4) 有没有更好的 .htaccess 文件?

4

1 回答 1

5

Your .htaccess is almost right, just minor corrections:

Options +FollowSymlinks -MultiViews
RewriteEngine on

# for http
RewriteCond %{HTTP_HOST} ^(www\.)?newdomain\.com$ [NC]
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*)$ http://CurrentDomain.com/$1 [R=301,L]

# for https
RewriteCond %{HTTP_HOST} ^(www\.)?newdomain\.com$ [NC]
RewriteCond %{SERVER_PORT} =443
RewriteRule ^(.*)$ https://CurrentDomain.com/$1 [R=301,L]

That way newdomain.com or www.newdomain.com will both be redirected with 301 to the browsers.

[NC] flag is for ignore case matching of host

于 2011-05-05T18:38:58.563 回答