Server side 301 redirects

 

On the 301 redirects page I have explained the utility of 301 redirects when migrating one website or when modifying some of the URLs of one website. The solutions given are ok but what if you have hundreds or thousands of pages to redirect? What if you are changing your domain name?

Well in these cases the redirects will be handled on the server side.

Let's start with the easier case: A domain name migration with no modifications of the pages name and with a IIS server.

I.E. http:www.myoldwebsite.com/page1  is becoming http://www.mynewwebsite.com/page1

You just have to follow the below steps:

One website is on the server with the host name www.myoldwebsite.com on the directory, for example, d:\www\myoldwebsite\ .

1 - On the same IIS server, create a new website with the host name www.mynewwebsite.com on the same directory (in my example: d:\www\myoldwebsite\)

2 - Go on the properties page on the first website (www.myoldwebsite.com), Click on the tab “home directory

  • Select “a redirection to the url"
  • Put in “redirect to” the hostname of the new website (www.mynewwebsite.com)
  • Finally select “a permanent redirection for this resource

DONE!

Now 301 redirections will work:

http://www.myoldwebsite.com is redirected to http://www.mynewwebsite.com

http://www.myoldwebsite.com/xxxx.asp is redirected to http://www.mynewwebsite.com/xxxx.asp