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:
- 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).
- 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).
- 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.
- And that’s it!