简体   繁体   中英

Permanent redirect using 301 and .htaccess

I had a site in a old domain ( http://domain1.com ) and I move it to a new one ( http://domain2.com ) because the site had a good SEO position on domain1.com I don't want to loose so I need to keep it and I think in a 301 redirection through .htaccess file. This is the line I'd add to .htacess file:

Redirect 301 /http://domain2.com/

But,

  • Is this the right way?
  • Is the line above good?
  • Since I haven't the hosting (files and more) under domain1.com should the .htaccess file be on domain2.com hosting?

Can any clear my doubts around this topics?

Yes, that is good solution. 301 is permanent redirect and is declared in standard HTTP Code. You can use, as you wrote, .htaccess file to do that, or configure DNS Servers to autoredirect all queries to this domain (see http://help.dnsmadeeasy.com/spry_menu/http-redirection-record/ ). I think second solution is better, because you don't need to pay for hosting anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM