View Full Version : Domain aliases and 301 redirects
wallacr
12-09-2009, 01:58 PM
As search engines aren't keen on the same content being on multiple domain names it would be nice if a 301 redirect could be put in place on domain aliases instead of having to add another domain (and losing one of my domain resourses) and setting that up for a 301 redirect.
This isn't the end of the world as I'm not near my limit, but it just came to mind and I thought I'd share my thoughts with you all :smilie:
Rich
Mark Voss
12-09-2009, 05:53 PM
There are ways to do a 301 redirect from an alias to a main domain.
I use a global.asa file on my main domain to do this for my asp sites:
<script language="VBScript" RUNAT="SERVER">
Sub Session_OnStart
Dim strHost
strHost = LCase(Request.ServerVariables("HTTP_HOST"))
If Not strHost = "www.main-domain.co.uk" Then
strHost = "www.main-domain.co.uk"
Dim strScript, strQuerystring, strURL
strScript = Request.ServerVariables("SCRIPT_NAME")
strQuerystring = Request.ServerVariables("QUERY_STRING")
If Not strQuerystring = "" Then
strQuerystring = "?" & strQuerystring
End If
strURL = "http://" & strHost & strScript & strQuerystring
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", strURL
End If
End Sub
</script>
Powered by vBulletin™ Version 4.0.3 Copyright © 2010 vBulletin Solutions, Inc. All rights reserved.