« “代码运行、复制、另存为”功能插件发布Apache修改配置文件启用.htaccess以及禁用目录列表的方法 »

使用apache的mod_rewrite模块实现二级域名技术

密陀僧发布 技术 2009年6月26日 次浏览
第一步,配置泛域名。包括:泛域名解析、泛域名绑定。
1、泛域名解析方法,以新网为例,主机名填*,IP地址填相应Ip。
2、泛域名绑定。

<VirtualHost *:80>
     DocumentRoot /yourwebpath/
     ServerName abc.com
     ServerAlias  *.abc.com
</VirtualHost>


第二步,二级域名的rewrite(确保mod_rewrite模块已加载)

RewriteEngine On 
RewriteBase / 
RewriteCond %{HTTP_HOST} ^[a-z0-9\-]+\.abc\.com$
RewriteRule ^/?$ /%{HTTP_HOST}
RewriteRule ^/([a-z0-9\-]+)\.36\.la/?$ action.php?act=$1 [PT] 


action.php接受act参数后,编写相关代码处理二级域名。
转载请注明:转载自漱风斋[ http://0e2.net/ ]

本文链接地址:http://0e2.net/post/1186.html

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Copyright 2009-3000 0e2.net. Some Rights Reserved.  Powered By Z-Blog.