How to setup 301 Redirects in IIS 7 for good SEO
Posted on Nov 14, 2011 by Paul White
Everybody knows that in order to properly preserve Google Page Rank when you are moving a page on a site, you need to perform a 301 Redirect to the new page, as this tells search engines this is a permanent move, and to record it into their index. However few people realize the additional problem of duplicate content across multiple domains. So if you have both your domain and your www subdomain pointing at the same site, its likely that google is penalizing you for this. So in this article I show you how to properly setup a website with multiple domains using IIS 7.5 and 301 redirects for good SEO
Setting up your websites
First you will setup two applications for each website ( not domain ). The first application will run the actual website. The second application will handle all the domains you plan on pointing at that website. In this Situation we will take a website I have already created, and reconfigure it for proper 301 Redirecting and SEO
In this case we are going to reconfigure godesssonya.com for proper 301 Redirects which should eliminate the duplicate content penalty and help give the site higher ranking and better SEO
Before I make these changes I want everything to see how things were initially setup.
As you can see before I setup the proper redirects I had my website setup to catch traffic from the IP directly, and all the domains, and their www subdomains. This was configured under the bindings section on IIS. This IS NOT
the proper way to setup websites
for better SEO
Creating a second Web Application to handle 301 Redirects
Important things to note
- Sitename is same except we append "Redirects" so we can easily recognize it.
- Set the Application Pool to the either a default, or the already existing one that will run the real website, there is no need to create a separate worker process just for redirects.
- Create a blank directory for the redirect website, This is needed to store the Web.config that runs the redirect website.
- Set the IP address to the one the domain points to
- Set the Host Name to any of the domains that will be redirected to the actual site
Even though it may seem tedious, what we have to do is setup two web applications. One is going to run your website, and the other is going to handle all the domains you want to redirect to that website. The Web Application that is supposed to run the actual website should only have 1 binding tied to it. In this case we are going to use the www subdomain as the default. Then we create a second web application which will be tied to the base domain, the IP address, and all other domains and subdomains we want redirected to the actual website.
Configuring the HTTP 301 Redirects in IIS 7.5
On the field "Redirect requests to this destination", you need to put the the domain your site will be running with. In my case it was http://www.goddesssonya.com, Then you need to add a $V$Q
to the end of the URL. This allows querystrings to be preserved during the direct. Else they will be chopped off. It took me a while to figure this one out. So in my case I typed. http://www.goddesssonya.com$V$Q. Then check the bubble
next to Redirect all requests to exact destination (instead of relative to destination). For the Status Code make it Permanent 301
. Then click Apply
at the top right
Setting up Host Names for Redirecting
Now that we have the Redirecting setup, we have to bind all the Host Names we want redirected to the default. So notice in this list I have all the domains except for the www version of the default of which will be directly binded to the Actual Website, and not the Redirect Application.
Finally we configure the bindings for the actual website, so that the only Host Name it captures for will be the www. Just to note it doesn't matter which instance of the domain you pick, just as long as you stick with it. A good idea would be to search google and see what version of your domain ranks high, then go with that one. Also people ( non techy ) seem to be stuck on the whole www subdomain, so if you are just starting out, stick with the www version.
How do I check if my 301 Redirects are working properly?
So now I have finally setup IIS 7.5 for proper 301 Redirecting for my client's website. However just to be sure its setup correctly, its a good idea to check with one of the online checkers.Check to see if your 301 redirects are setup correctly here
This site has a nice little tool that will tell you if your Redirects are Search Engine Friendly.
Godaddy forwarding is not a 301 Redirect
For those of you who just forward your domains using Godaddy
, you might want to rethink this. I found that for domain that used Godaddy
's built in forwarding service, they did not validate as search engine friendly, of if they did forward them the relative paths were not preserved.
Hopefully this helps others who are wondering how to setup redirects properly using IIS 7.5