时间:2023-02-26 09:45:01 | 来源:建站知识
时间:2023-02-26 09:45:01 来源:建站知识
如何实现输入域名自动跳转到域名下得到一个文件夹下?:目前我使用的是ASP页面跳转,不是太完美,如果有改进办法请联系我。<%if Request.ServerVariables("SERVER_NAME")="http://www.98gu.com" then Response.Status="301 Moved Permanently"Response.AddHeader "Location","http://www.98gu.com/index.php"Response.Endelseif Request.ServerVariables("SERVER_NAME")="blog.98gu.com" then Response.Status="301 Moved Permanently"Response.AddHeader "Location","http://blog.98gu.com/blog/"Response.Endend if%>如需增加跳转只需要复制
elseif Request.ServerVariables("SERVER_NAME")="blog.98gu.com" then Response.Status="301 Moved Permanently"Response.AddHeader "Location","http://blog.98gu.com/blog/"Response.End这段即可,跳转上限根据虚拟主机可以绑定多少域名来决定,理论上可以无限增加。
<%if Request.ServerVariables("SERVER_NAME")="www.98gu.com" then response.redirect "/index.php" elseif Request.ServerVariables("SERVER_NAME")="blog.98gu.com" then response.redirect "blog/" end if%>原理是一样的,对于301跳转还是302跳转还请自己选择,跳转的缺陷还在思考怎么解决,最好还是多虚拟主机吧。
关键词:文件,实现,输入