您的位置:首页 > 服务器 > IIS/Apache

用rewrite实现APACHE绑定多域名

日期:2005-10-05 00:00:00 点击: 来自: 作者:

编辑httpd.conf
在最后加上


  QUOTE:
NameVirtualHost *

<VirtualHost *>
rewriteengine on
rewritecond %{HTTP_HOST} [^.]+/.alibaba/.uni/.cc$
rewriterule ^(.+) %{HTTP_HOST}$1 [C]
rewriterule ([^.]+)/.chinahtml/..com(.*) /$1$2
    ServerAdmin webmaster@XXX.COM
    DocumentRoot /www
    ServerName chinahtml.com
    ErrorLog logs/chinahtml.com-error_log
    CustomLog logs/chinahtml.com-access_log common
</VirtualHost>


http://username.chinahtml.com对于username的主页请求转换为对http://chinahtml.com/username的请求
---- 对于HTTP/1.1的请求包括一个Host: HTTP头,我们能用下面的规则集重写 http://username.chinahtml.com/anypath到/home/username/anypath。
注: “rewritecond”表明是条件重写规则,当满足后面定义的条件后才会应用下面的重写规则,“rewritecond”有各种变量,请查阅相关文档。

其实是用到了APACHE的重写规则,大家可以看
http://chinahtml.com
我现在还开着的!
你可以打开里面的目录像这样打开测试一下
http://skyspy.chinahtml.com
http://discuz.chinahtml.com

More..素材图片 Picture Navigation
  •  彩云之南
  • 《超宽屏壁纸》带你体验大自然的魅力
  • 18张最美丽的北京风光 1600X1200 像素
  • 2ADVANCED 2006 壁纸系列
相关链接 Correlation Link
IIS/Apache热门 Class Hot
IIS/Apache推荐 Class Commend
版权所有:中国网站资源 2005- 未经授权禁止复制或建立镜像 This Site Tech:XHTML+DIV+CSS+Javascript
CopyRight ® 2005- www.Chinaddv.com online services. all rights reserved. ICP06016627
Optimized to 1024x768 to Firefox,Netscape,Opera,MS-IE6+.