apache下启用二级域名泛解析,实现博客功能

httpd_vhosts.conf文件内容

<VirtualHost *:80>
DocumentRoot “d:/site/papake.cn”
DirectoryIndex index.htm index.php

<Directory “d:/site/papake.cn”>
Options Indexes MultiViews
AllowOverride None
order allow,deny
Allow from all
Options FollowSymLinks Includes
</Directory>

RewriteEngine on
RewriteLog       logs/re.log
RewriteLogLevel  1
RewriteCond %{HTTP_HOST} ^[a-zA-Z0-9-]+.papake.cn$
RewriteCond %{HTTP_HOST} !^(www).papake.cn$
RewriteRule ^/?$ /%{HTTP_HOST} [NC]
RewriteRule ^/([a-zA-Z0-9-]+).papake.cn/?$ http://www.papake.cn/$1 [P,L]

RewriteLog “D:/Apache2.2/logs/rewrite.log”

</VirtualHost>

以上要实现输入lihai.papake.cn的网址,实现处理的是www.papake.cn/lihai此文件夹里的内容的,除了www这个以外.

需要启用的模块有:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so