301重定向域名更改

时间:2015-02-24 23:33:06

标签: .htaccess redirect duplicate-content

我的朋友想将她的域名oldsite.com更改为newsite.com。

托管公司是lukrativedomains,他们建议将域名更改为newsite.com,然后将oldsite.com转发到newsite.com

但是,他们提供的转发功能会将所有页面重定向到root newsite.com。我希望能够将oldsite.com的所有单个页面转发到newsite.com上的同一页面

我是否需要将内容从oldsite.com复制到newsite.com然后实施301重定向?如果是这样,我该怎么做,那会是重复的内容吗?

另外,我如何为每个页面执行301重定向?我需要她什么? (htaccess?如果是的话会在哪里?)

截至目前,newsite.com上没有任何内容,它只是一个停放的页面,但我希望它看起来与oldsite.com完全一样。

这一点非常重要,同时尽量减少对SEO的影响。她不使用wordpress,事实上,我不确定内容的存在位置(我在某处猜测ftp)

1 个答案:

答案 0 :(得分:0)

这是我在这种情况下要做的步骤

  1. 创建完整的站点备份(文件和数据库)
  2. 将它们上传到新网站,检查一切正常。
  3. 在根文件夹中(通常如果您使用的是Cpanel,它将是public_html文件夹)我将创建带有301重定向的.htaccess文件
  4. 代码示例:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^oldpage.html$ http://www.newsite.com/newpage.html [R=301,L]
    </IfModule>
    

    好好看看3ed系列发生了什么, 我说RewriteRule然后&#34; ^&#34;和页面的名称,看起来像这样的完整网址:http://www.oldsite.com/oldpage.html

    例如,假设您要重定向此网址: http://www.oldsite.com/categories/business/news.html 你会这样说的:

    RewriteRule ^categories/business/news.html$ http://www.newsite.com/categories/business/news.html [R=301,L]
    

    如果它不以.html .php结尾,它将如下所示:

    RewriteRule ^categories/business/news/$ http://www.newsite.com/categories/business/news/ [R=301,L]
    

    另外,如果您想了解更多关于重定向的信息,我建议您阅读本文:http://moz.com/learn/seo/redirection

相关问题