如何为域或主页差异创建301重定向
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何为域或主页差异创建301重定向相关的知识,希望对你有一定的参考价值。
Learn how to create a 301 redirect for domain or home variations to improve your websites' search engine optimization.
'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
以上是关于如何为域或主页差异创建301重定向的主要内容,如果未能解决你的问题,请参考以下文章
使用 301 重定向重定向 404 是将现有页面重定向到主页