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 to in just four lines of code.

RewriteEngine On

RewriteBase /


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

RewriteRule ^.*${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.

Please type your full name.
Invalid email address.
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