我在同一台服务器上有两个工作域。
如何将旧临时域上的所有文件的所有流量转发到新的正确域? 似乎这可能是一个搜索引擎优化问题? 但是,由于临时测试域未注册,是否会被抓取? 这甚至是个问题吗?
我目前正在使用:
RewriteEngine On
# Force to WWW
RewriteCond %{HTTP_HOST} ^thecorrectdomain\.com
RewriteRule (.*) http://www.thecorrectdomain.com/$1 [R=301,L]
#
在我们将域名指向新服务器之前,不正确的域是我们用于测试的设置。 第二个是正确的域名。
不正确的测试域看起来像: http://1234.hostingcompany.com/~username/index.php
预期的正确域名如下: http://thecorrectdomain.com/index.php
或者这是托管公司必须在他们的级别做什么?
答案 0 :(得分:0)
假设hostingcompany
支持.htaccess。您在http://1234.hostingcompany.com/~username/
中创建了一个.htaccess,其中包含以下内容:
RewriteEngine On
#might not be necessary
RewriteBase /~username
RewriteRule .* http://thecorrectdomain.com/$0 [R=301]
PS测试时使用302而不是301。