IIS7 and non-www prefix on domain

Listen to this text

Be warned, this is a somewhat technical post. It took me a while today to figure why my webserver running IIS7 was not loading up my website whenever the “www” prefix was not included. So for instance, “ariyam.com” was sending out a 404 error, while “www.ariyam.com” was working correctly. After spending a lot of time Googling my way to a solution I actually ended up in a dead-end and had to figure this out on my own. Others had suggested adding “redirect” rules, but that didn’t seem to work for me. Turns out the problem is incredibly easy to fix on IIS7. Here’s how you do it:

  1. Firstly, open up a command prompt and make sure “www.domain.com” and “domain.com” are pointing to the same IP. You can either run “ping www.domain.com” or use “nslookup www.domain.com” to do this. If the IPs don’t match, you have a DNS issue which you need to resolve first (don’t ask me how).
  2. Assuming the IPs match for the non-www domain and the regular domain, you can then proceed to your web server and launch the IIS7 management (inetmgr).
  3. The issue is something called “binding”. All you have to do as add another “binding” entry on IIS for your website. It takes about 10 seconds. Once you have IIS7 open, click on your website and click the Binding link on the right, click add, then put in the domain name minus the “www” prefix. See the screen shots below.
  4. And that’s it!

2 thoughts on “IIS7 and non-www prefix on domain”

  1. Holy crap, thank you! Google’d for 30 minutes with no luck. Finally I ran into this, EXACTLY what I was looking for. Thanks a ton for taking the time to write this up!

  2. Thank you so much for this post. It was exactly what I needed to fix a problem with my server.

Comments are closed.