Menu

Using .htaccess to move domains

To maintain traffic and search engine rankings after moving a website, it is really useful to use the address rewriting capabilities available on most modern web servers. The ReWrite Module is often available on both Apache and IIS web servers to facilitate this. This, coupled with a 301 Permanent Redirect instruction allows you to redirect all of the old pages from a domain to the equivalent area on a new domain by matching the pattern, rather than listing thousands of individual redirect instructions.

The example instruction below will redirect www.myoldsite.com/anyexistingpages.htm to www.mynewsite.ie/anyexistingpages.htm in just four lines of code.

RewriteEngine On

RewriteBase /

 

Rewritecond %{HTTP_HOST} www\.myoldsite\.com$

RewriteRule ^.*$ http://www.mynewsite.ie/{R:1} [R=301,L]

The code should be added to the .htaccess file which resides in the root of your website directory. Remember to always backup before attempting changes. Incorrect changes to a .htaccess file can render your website inaccessible.

Last modified onFriday, 17 January 2014 13:22
back to top

Enjoyed this post? Don't miss out! Connect up with us:            

Free assessment

Send us your details and we will complete a free assessment of your online business presence.

Name*
Please type your full name.
E-mail*
Invalid email address.
Domain*
Invalid domain name
Phone #*
Invalid Phone #

Invalid Captcha

We use cookies to improve your experience. By your continued use of this site you accept such use I understand