In my previous post 301 Redirect: Why 301 Redirect (Permanent Redirection) Is Important? I have explained about the importance of 301 redirection in SEO.
Now its time to know how we can do the 301 redirect for our website.
How to do 301 redirect?
There are two possible ways to do 301 redirect, which depends on the type of web server - Apache or IIS (Microsoft) - that you’re running.
Open a notepad and paste the below mentioned lines.
Again here, in place of ‘yourdomain’ mention your domain name.
Now save the file as .htaccess. Place the .htaccess file into your root folder where your site index file is. That’s it. You have done it!
IIS Server (Microsoft) : You have to create two websites in the IIS configuration. The first one will the primary domain and the second one will be redirecting to the primary.
- Log in as an Administrator and choose:
- Start >> Programs >> Administrative Tools >> Internet Services Manager.
- Choose the server which is hosting your primary domain.
- Right click on the site you want to redirect FROM and choose Properties > Home Directory. You will see
- Select the radio button "a redirection to a URL".
- In the “Redirect to:” field, enter the domain you want to redirect to. For example, if you want to redirect to www.yourdomain.com, enter http://www.yourdomain.com in this field.
- In the “The Client will be sent to” field, select “A permanent redirection for this resource.” This will create a 301 redirect from your primary domain to yoursite.com.
- Now click on ‘Apply’. That’s it.
We have done with 301 redirect for our website. Now how to track the visits receiving from redirected domain. My next post will carry the details about how to track the visits coming from redirected domain. If you want receive the latest updates from the blog please subscribe for the blog!