How to setup a permanent domain redirect ? How to change your domain name ?

This post answers the following questions

How to redirect your website to a new ? or how to change a name ?

How to setup a 301 permanent redirect ?

How to setup .htaccess file?

Most website owners might end up facing these questions, when we start our website we would be happy with a name but at a later stage might find some other name more suitable for the website. So how to set up a new domain name without losing your existing subscribers, Search rank and old website name ? Well is actually very simple, setup a 301 Permanent redirect. It will redirect every of say site x.com to y.com.

For example you currently have website named my-shop.com and you want to rename it to myshop.com. Then you need to setup the 301 redirect in the root directory of my-shop.com.

In your domains control panel my-shop.com might point to folder named /myshop or even the root directory / (if you have only one website).

So everytime a request to access my-shop.com will be serviced from this folder's content.
For changing the domain point your new website name myshop.com to point to folder /myshop and my-shop.com to point to a new folder /oldshop. Then in this oldshop folder create a file .htaccess (only extension no actual file name). In that file enter the following

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.myshop.com/$1 [R=301,L]

If user clicks a link of the my-shop.com .. say www.my-shop.com/files/index.html the 301 redirect will instead load http://www.myshop.com/files/index.html. Basically it replaces the x by y or old site name by the new name and preserving all the urls.

Typically search engines like Google will learn to go to new site and index its content automatically within a month. And meantime you will not lose any visitors/search .

(Visited 95 times, 1 visits today)

One Reply to “How to setup a permanent domain redirect ? How to change your domain name ?”

Leave a Reply

Your email address will not be published. Required fields are marked *