许多域名都绑在上面,而且也就一个虚拟目录的话就可以这么做。我开始买服务器的时候那IDC商说可以绑12个域名,而且说的和租,就以为那多分几个目录没什么关系。 但是结果我注册交钱了却12个域名只能指向同一个目录,无奈就只有想出这个鬼方法。 使用方法很简单, 比如第一句,的意思就是用户输入的是hi1000y.cn,那么就自动跳转到http://hi.baidu.com/netfate ,面的意思都是样的。 SERVER_NAME是输入的,response.redirect是要跳转到那去的,在根目录下多建几个文件夹,把不同的程序放到不同的目录。在index做出判断,然后根据用户输入的域名在跳转到相应的目录,这样就搞定了。不过在写程序的时候,比如image等等,要把路径写全。
方法一:asp
if Request.ServerVariables("SERVER_NAME")="hi1000y.cn" then
response.redirect "http://hi.baidu.com/netfate"
elseif Request.ServerVariables("SERVER_NAME")="www.hi1000y.cn" then
response.redirect "http://hi.baidu.com/netfate"
elseif Request.ServerVariables("SERVER_NAME")="www.baidu12.com" then
response.redirect "http://hi.baidu.com/netfate"
elseif Request.ServerVariables("SERVER_NAME")="baidu12.com" then
response.redirect "http://hi.baidu.com/netfate"
elseif Request.ServerVariables("SERVER_NAME")="www.baidu12.com" then
response.redirect "http://hi.baidu.com/netfate"
elseif Request.ServerVariables("SERVER_NAME")="baidu12.com" then
response.redirect "http://hi.baidu.com/netfate"
elseif Request.ServerVariables("SERVER_NAME")="baidu12.com" then
response.redirect "http://218.61.50.2:60004/"
elseif Request.ServerVariables("SERVER_NAME")="www.baidu12.com" then
response.redirect "http://218.61.50.2:60004/"
elseif Request.ServerVariables("SERVER_NAME")="baidu12.com" then
response.redirect "http://61.176.204.208:60005/"
elseif Request.ServerVariables("SERVER_NAME")="www.baidu12.com" then
response.redirect "http://61.176.204.208:60005/"
else
response.redirect "http://61.176.204.208:60005/"
end if
%>
asp版的还有人这么写:
response.redirect http://www.baidu12.com/bb0552/
else%>
response.redirec