Why does my website not load if I type:
example.com
But it does work when I type:
www.example.com
Is this a setting in IIS?
We are using ASP.NET 3.5 with a SQL Server database.
Thanks in advanced!
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityEven if you have the DNS records for example.com and www.example.com pointing to the web server, you must still tell IIS7 which site to serve up when it sees these domains.
This is acheived through adding a "Binding" for each domain name (called a Host Header) to tell IIS which "site" to serve up to the client.
You will need a binding for "www.example.com" and a binding for "example.com".
See a picture here: http://www.iishacks.com/wp-content/uploads/2008/10/host-header-iis7.gif
What you need is having tool for URL rewrite to check if URL was put as http://domain.com, if so - add www. inside. For this things you'll need additional software for redirect. Me myself was using ISAPI_Rewrite tool for simple things like rewrite, also this software can be provided free. Now I'm using Helicon Ape as an Apache emulator for IIS7.
Typically you have to actually add a DNS record for example.com to your DNS in order for your site to be accessible at both example.com and www.example.com - if both of these records already exist in the DNS then it's probably an IIS setting somewhere
Kenny's solution is probably the simplest. But if your web pages or application code depend on the url being www.example.com, they won't work properly.
A different solution is to set up a new site for example.com in IIS and use an http redirect to refer requests to www.example.com. Your users' sessions will continue on www.example.com, and all your site code will work as normal.
In apache I would add www.example.com as an alias to example.com and done.
I suppose in IIS should be the same principle...