Forum Moderators: open
<%
referrer = request.servervariables("Server_name")
If referrer= "Domain.co.uk" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.Domain.co.uk/"
Else if referrer= "Domain.co.uk/index.asp" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.Domain.co.uk/"
Else
END IF
End IF
%>
Will this solve my problem as does work and refers to www. and give a permantent moved, is this correct?
>> This condition will be true for all urls along with home page that do not have www, resulting in all urls getting redirected to home page.
Else if referrer= "Domain.co.uk/index.asp" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.Domain.co.uk/"
>> This condition will never be true. request.servervariables("Server_name") does not give full url.
If Server_name= "Domain.co.uk" then
WWWServer_name = "http://www." & Server_name
If url = "/index.asp" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", WWWServer_name
elseIf url <> "" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", WWWServer_name & url
else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",WWWServer_name
end if
End If