If you wish to use always http://www.domain.com instead of http://domain.com, in ASP .Net a solution is to modify the file global.asax:
protected void Application_BeginRequest( object sender, EventArgs e){
//check the request to make it starts with www
//and is not localhost (dev)
if (!Request.Url.Host.StartsWith( "www" ) && !Request.Url.IsLoopback)
{
//now ... redirect.
UriBuilder builder = new UriBuilder (Request.Url);
builder.Host = "www." + Request.Url.Host;
Response.Redirect(builder.ToString(), true );
}
}
There are and other solution, like httpd.ini, or depending what you use. In PHP (Apache) I solve this by adding in the top of .htaccess file this code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Why to use this? The 1st reason is for seo (you will see that in a future article) and another reasons is that it looks more profesional.
d4233f28-853d-47b0-9189-7dbc1cad6d5a|0|.0