|
|
我有一虚拟空间,有2个域名,空间内建2个目录。如何用ASP程序判断域名并转向到相应目录: S3 V' F' [: w5 Z
要求当用A域名访问时间,自动转到A目录中的内容
, k( g: u) A- s& C4 R用B域名访问,转到B目录, h# _ d4 A/ R& w
. L% i5 N ?/ y X6 c3 n第一个实现方法:9 _7 R) J' {$ ^+ D- ~0 M
<%if Request.ServerVariables("SERVER_NAME")="www.site1.com" then9 @; E0 `, G& C/ _$ F, |
response.redirect "site1.htm"
' M4 A5 r9 y. T. Kelse
# R. S* v" P" C" H( mresponse.redirect "site2.htm"3 I6 ]9 O) [. H8 M. k, t' P! F' X1 v
end if%>
- H3 K1 X# D0 n, u8 s- p
( S* U, m W1 }: G# q. m/ J第二个$ N& p9 B/ `, O5 G! B4 f! Q
<%
" i, r1 [* W9 T6 q: f8 x2 `8 D Uselect case request.servervariables("http_host")1 P* ~2 Q- D# h2 }; q
case "www.site1.com" . v; ]& U2 l/ a) J
Server.Transfer("1.htm")3 r' ^4 I [$ u) N$ L
case "www.site2.net" 7 [; q, h1 t$ ?+ G+ t( k7 [% J& `
Server.Transfer("2.htm")4 {; E# G2 H4 y/ p
case "www.site3.cn"
7 q" q: f6 H* o( J, |5 m! h7 Y2 dServer.Transfer("3.htm")* V/ V, V4 B, y* s1 N
end select
4 r4 M& g" C, x* l- G2 ^- b%>
0 O2 D8 a% |- R; q: A- a
2 ^( W, b, Q( d5 |+ V; g注意:以上两个代码需要另存为asp文件才可以使用,html文件无法使用, |
|