Question : Redirect non-www to www Url

Hello,

What is the best way to redirect any non-www url for a domain to its www counterpart with complete transparency to the user?  We are using a web farm, about 12 servers, and I have been told that doing this at the IIS level is too difficult and that we need to come up with an application solution.  What is the best way?

Running Windows 2008 Server, IIS 7, .net 3.5, etc.....

Most solutions I find deal with setting up a 301 or 302 error solution but it doesn't make much sense to me.  I want the user to be able to type google.com and then have it redirect to www.google.com without them really even knowing.  

Hopefully I have this in the right zone, I guess it depends on the solution involved.

Thanks in advance.

Answer : Redirect non-www to www Url

A 301 is a transparent solution _at_the_web_server_ and is precisely how Google performs such activity:

GET / HTTP/1.1
Host: google.co.uk

HTTP/1.1 301 Moved Permanently
Location: http://www.google.co.uk/
Content-Type: text/html; charset=UTF-8
Date: Fri, 31 Jul 2009 15:57:39 GMT
Expires: Sun, 30 Aug 2009 15:57:39 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 221

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.co.uk/">here</A>.
</BODY></HTML>


... to perform this yourself, you will have to create a new "web site" in your IIS which hosts example.com (no-www) with just a redirect.
Random Solutions  
 
programming4us programming4us