ASP.NET网站如何实现不同域名解析不同的子目录
来源:互联网 发布:淘宝搜索暗语大全 编辑:程序博客网 时间:2024/05/02 01:31
准备在自己的主机里引用多个域名,先找点资料
著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。作者:玉成
链接:https://www.zhihu.com/question/26014907/answer/31856727
来源:知乎
这是一段很有用的代码,和绑定多域名的ASP代码类似,如果你只有一个PHP空间,而你又想放置多个多个站点,下面这些代码可以帮到你第一个:程序代码if($HTTP_HOST=="www.nuobg.com"){Header("Location: index.htm");}elseif($HTTP_HOST=="www.jwzjs.com"){Header("Location: wiljwzjs.htm");}else{Header("Location: other.htm");}第二个:程序代码if($HTTP_HOST=="www.nuobg.com"){require "moon.htm";}elseif($HTTP_HOST=="www.jwzjs.com"){require "williamlong.htm";}else{require "other.htm";}二用JS来实现多域名的跳转<script>try {if( self.location == "http://玉米一/" ) {top.location.href = "http://玉米一/目录";} else if( self.location == "http://玉米二/" ) {top.location.href = "http://玉米二/目录";} else if( self.location == "http://玉米三/" ) {top.location.href = "http://玉米三/目录";} else if( self.location == "http://玉米四/" ) {top.location.href = "http://玉米四/目录";} else {document.write ("错误的访问地址")}} catch(e) {}</script>
如果只有一个ASP空间,而你又想放置多个多个站点,这些代码可以帮到你第一个 程序代码<%if Request.ServerVariables("SERVER_NAME")="www.nuobg.com" thenresponse.redirect "blog/index.asp"elseresponse.redirect "index2.asp"end if%>第二个程序代码<%select case request.servervariables("http_host")case "www.nuobg.com" '1Server.Transfer("v3.htm")case "www.jwzjs.com" '2Server.Transfer("i.htm")case "www.abcwj.com" '3Server.Transfer("write100.htm")...... 继续添加 ......end select%>第三个程序代码<%if instr(Request.ServerVariables("SERVER_NAME"),"www.nuobg.com")>0 thenresponse.redirect "index.asp"elseif instr(Request.ServerVariables("SERVER_NAME"),"www.jwzjs.com")>0 thenresponse.redirect "x/index.asp"elseif instr(Request.ServerVariables("SERVER_NAME"),"www.abcwj.com")>0 thenresponse.redirect "index3.asp"end if%>第四个程序代码<%if Request.ServerVariables("SERVER_NAME")="www.nuobg.com" thenresponse.redirect "index1.asp"elseif Request.ServerVariables("SERVER_NAME")="www.jwzjs.com" thenresponse.redirect "index2.asp"elseif Request.ServerVariables("SERVER_NAME")="www.abcwj.com" thenresponse.redirect "index3.asp"end if%>第五个程序代码<%if Request.ServerVariables("SERVER_NAME")="www.nuobg.com" thenServer.Transfer("williamlong.htm")elseif Request.ServerVariables("SERVER_NAME")="www.jwzjs.com" thenServer.Transfer("moon.htm")elseif Request.ServerVariables("SERVER_NAME")="www.abcwj.com" thenServer.Transfer("write100.htm")elseServer.Transfer("other.htm")end if%>
0 0
- ASP.NET网站如何实现不同域名解析不同的子目录
- 同一网站不同和二级域名和不同子目录的cookie
- tomcat部署多个项目,通过不同域名解析访问不同的网站
- 同一网站不同和二级域名和不同子目录的cookie 作用范围问题
- 在 ASP.NET 中实现不同角色的用户使用不同登录界面的方法
- 在 ASP.NET 中实现不同角色的用户使用不同登录界面的方法
- 在 ASP.NET 中实现不同角色的用户使用不同登录界面的方法
- 在 ASP.NET 中实现不同角色的用户使用不同登录界面的方法
- 在 ASP.NET 中实现不同角色的用户使用不同登录界面的方法
- 在 ASP.NET 中实现不同角色的用户使用不同登录界面的方法
- asp.net中jqgrid根据不同类别头部显示不同的列的实现方法
- ASP.NET与ASP的不同
- 介绍ASP.NET 和 ASP的不同
- 如何配置Apache不同的端口指向不同的网站
- 域名解析到主机不同端口的设定
- 不同操作系统下域名解析文件是不同的
- asp.net不同后辍名的文件
- tomcat部署多个项目,公网通过域名解析访问,不同的网站。
- 移动平台unity3d优化
- mybatis 一对多关系 list 的返回
- [置顶] 每天进步一点点——五分钟理解一致性哈希算法(consistent hashing)
- Linux系统上用Firefox浏览器访问Flash网站
- swift2.0异常处理
- ASP.NET网站如何实现不同域名解析不同的子目录
- Paper Reading 1 - Playing Atari with Deep Reinforcement Learning
- Date工具
- 深度学习(二十二)Dropout浅层理解
- VS2012 下编译boost1.52
- urllib2请求csdn时,显示: urllib2.HTTPError: HTTP Error 403: Forbidden
- ARM TrustZone
- fresco添加http header
- Top k 算法