日期:2014-05-16 浏览次数:20904 次
在我最近给《商业网站开放服务平台》项目中,我需要给自动生成的网站设置一个二级域名,在Linux下配法比较简单,由于开发环境是windows,所以折腾了蛮久查了点资料才配起来了,在自己的博客中记录一下,我是这么做的:
<VirtualHost *:80> DocumentRoot "全路径" ServerName faqee.com ServerAlias *.faqee.com RewriteLog C:/rewrite.log RewriteLogLevel 0 RewriteEngine on RewriteMap lowercase int:tolower RewriteMap vhost txt:C:/vhost.map RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$ RewriteCond ${vhost:%1} ^(C:/.*)$ RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}] ErrorDocument 404 http://www.faqee.com/test/404.html ErrorDocument 400 http://www.faqee.com/test/404.html ErrorDocument 500 http://www.faqee.com/test/500.html ErrorDocument 503 http://www.faqee.com/test/500.html </VirtualHost>?
注:我使用的apache 2.2.8版本上测试通过