|
我有一虚拟空间,有2个域名,空间内建2个目录。如何用ASP程序判断域名并转向到相应目录" Y* [2 l1 r. W
要求当用A域名访问时间,自动转到A目录中的内容- }. x2 ^& v* v2 i
用B域名访问,转到B目录; W* ^/ z& M7 G5 R- c
( u3 }! z$ D3 h3 y$ J) ^第一个实现方法:. K9 p+ M& P M+ P2 B9 J
<%if Request.ServerVariables("SERVER_NAME")="www.site1.com" then) y; C$ r4 |4 q+ ~& P
response.redirect "site1.htm"- L" x; _, x7 {5 o6 D6 B1 b
else
, @ N0 ^$ y W7 yresponse.redirect "site2.htm"9 L- G# q" O4 G6 A, n8 Y
end if%>. X3 f& x1 t( i! C; t
# a; I7 R3 C7 W& S2 O. I& ^第二个; W& Y+ i ^8 I" o* S& q J
<%1 X* I6 R5 n! w/ f g# p' k
select case request.servervariables("http_host")
1 ]" e5 ?7 n- s, a6 ^) G- `6 }! wcase "www.site1.com" 3 }4 R; G2 E, D9 z. m3 F
Server.Transfer("1.htm")
- @, Y4 e) T% Z* q) y# ^/ S! @case "www.site2.net" " ~+ t" Z# [ N& ^
Server.Transfer("2.htm")7 E7 [3 E) `$ L2 Z; x
case "www.site3.cn" 2 I0 [4 \% V9 V/ m
Server.Transfer("3.htm")
) o% V% ?- X1 h, @# [: yend select% d W3 ~4 a: s4 B i7 l! i
%>$ x' i ~/ _; ?4 P9 s. N
. A" F. o$ Y& z9 m9 h. d/ Y' n8 |
注意:以上两个代码需要另存为asp文件才可以使用,html文件无法使用, |
|