This post answers the following questions
How to redirect your website to a new address ? or how to change a domain 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, google Search rank and old website name ? Well it is actually very simple, setup a 301 Permanent redirect. It will redirect every url 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 results.
One Reply to “How to setup a permanent domain redirect ? How to change your domain name ?”