Force One Domain with ASP

Published in Website Design on Wednesday, 22 April 2009  |   Subscribe to rss feed for Force One Domain with ASP (rss logo graphic) Post RSS

The WWW Difference

Did you know that  http://www.mywebsite.com and http://mywebsite.com are actually 2 different domains and are seen by Google as 2 distinct websites? 

For SEO (search engine optimisation) purposes, this dilutes the page rank and potentially the visibility of your website by half.

Forcing One Domain

ASP can be used to redirect all traffic from the non www version to the www version of your website (or vice versa).

A 301 redirect inserted into your website template (or into each page) ensures that all links and traffic to your website will be sent to just one version.

Get The Code

<%

'---------| FORCE ONE DOMAIN |----------

If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www." & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")
Response.End
End if

%>


All resources written by The WebFertile Team.

Whatever your business needs, one of our highly trained small business development experts is sure to be able to help.