时间:2023-06-29 03:39:01 | 来源:网站运营
时间:2023-06-29 03:39: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跳转还请自己选择,跳转的缺陷还在思考怎么解决,最好还是多虚拟主机吧。
关键词:办法,虚拟,主机