# Can't view website with public IP, but www.example.com & example.com work fine

I am facing a problem with a web application on IIS 7.0. Our server configuration is Win 08 server R2 and has a public IP. The problem is, when an application is web hosted on IIS 7.0 and when it is browsed it works fine, but when the same page is accessed using public IP it throws 404 page or directory not found error. And the IIS 7.0 shows default IIS page when browsed from public IP. I am not sure why there is a problem. Can anyone help me on this issue?

-

Wait, what? If you're getting a 404 then you are resolving your web server (if it wasn't resolving you'd be getting nothing, especially not a 404). I think you're getting your terminology all mixed up.

There's no such thing as "DNS Manager Forwarding". Your hosting company doesn't do anything with your "A" records, your DNS hosting company does (unless they are the same thing)

To be honest, it sounds like you have hostname bindings on your IIS website, and you just need to add additional bindings for your non-www domain.

I.E. In your IIS website, under bindings, you have example.com in there, but not www.example.com

-
Ok, I have the site setup like that already. (example.com and www.example.com) My server's IP is the same as the site's IP with port 80 listed in the bindings. I have removed the website that is not being used anymore on this server, hoping it would resolve that way but I still get 404. Since it's now the only website on the server and I go in the "Bindings" and edit IP Address to All Unassigned. Do you think it will resolve then? Also, do you think because both sites were on port 80, I am getting the 404 because of that? –  notanITguru Feb 7 '13 at 13:55

If you're getting HTTP status 404 then the client is communicating with the server but the server can't find what the client requested, which tells me that your web site default document is probably not configured correctly or you don't have a host header configured for the naked domain name.

-
In the Default Document, do they need to be case-sensitive? It has "index.aspx", but the actual file is "Index.aspx". It is a production server with tons of users online right now. If I make the change will that effect the site? –  notanITguru Feb 7 '13 at 15:46
I don't believe it's case sensitive. After reading your question again, my assumption is that it's a host header problem and not a default document problem. If you can get to the site by www.domain.com but not by domain.com then you need to add a host header to the site for the naked domain. –  joeqwerty Feb 7 '13 at 15:49
I can't pull up the site with dedicated public IP. I can however, pull it up with domain name. Both "www.domain.com" and "domain.com" Just not with IP. –  notanITguru Feb 7 '13 at 15:52

Sounds like your web server is expecting a canonical www.yoursite.com server request, but has no default rule set. I'm not an IIS guy (mostly Apache and nginx), so I can't speak to how to set it up, but web servers expect a server name in the request, and can only match what you've configured. You'll need to set up a rule somehow in IIS that says "if the header request is yoursite.com (not just www.yoursite.com) then point the request to document root located at X:\path\to\website."

-
I am looking at your header suggestion now. –  notanITguru Feb 7 '13 at 14:54