/ Published in: ASP
Learn how to create a 301 redirect for domain or home variations to improve your websites' search engine optimization.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
'301 Redirect - URL Must Contain www.domain.com CorrectDomain = "www.domain.com" DefaultPage = "/index.asp" QueryStrings = request.ServerVariables("QUERY_STRING") URL = request.ServerVariables("URL") if instr(request.ServerVariables("SERVER_NAME"),CorrectDomain) = 0 then if QueryStrings <> "" then QueryStrings = "?" & QueryStrings end if if instr(URL,DefaultPage) then URL = replace(URL,DefaultPage,"/") end if response.Status = "301 Moved Permanently" response.AddHeader "Location","http://" & CorrectDomain & URL & QueryStrings response.End end if
URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=22