Question

Poorly worded title, but what I want is to do essentially what StackOverflow does when someone types in www.stackoverflow.com: it redirects immediately to stackoverflow.com, eliminating the www. entirely.

Imo, this is the more modern way of doing things: the www. is redundant and (soon to be) archaic. It also breaks an important principle that I want to follow on my web application: that each unique and valid page be accessible by a single url only.

I realize this is a server thing, so I'm expecting the answer to be that the web host needs to take care of this. Since I don't run my own servers, my question is thus: is this possible to do on shared hosting or does one need to be running a dedicated server in order to configure IIS to do this?

Was it helpful?

Solution

The IIS URL Rewriter will allow you to easily set up a canonoical domain rule so all requests are either redirected to www or non www based on your choice. More info on how

Also, several .net shared hosting providers have this module installed so that you can configure this option like you could on your own iis server.

OTHER TIPS

www. is not redundant or archaic if you are using other subdomains. There are issues with cookies that you have to deal with if you set stackoverflow.com as the root domain.

That being said, you would probably want to do something like my answer to a previous question here:

remove 'WWW' in ASP.NET MVC 1.0

Based on the similarities to this question, and based on your tags, I'm voting to close as a duplicate.

Most hosting providers give this for free. The trick itself is usually performed on the DNS level, by introducing a no-hostname A record in your domain.

And this principle of yours is unattainable in principle. At the very least, there's always the URL with IP address instead of name. Then, your server will, most likely, have a private name like server1334.hostingprovider.com, which is also accessible to the world.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top