首先,你的拥有一个有泛域名解析的顶级域名,例如: domain.com其次,在 httpd.conf 中打开 mod_rewrite之后,在 httpd.conf 的最后,添加以下内容
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/usr/local/etc/apache/vhost.map
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1
http://jingyan.baidu.com/article/ceb9fb10ed6ef08cad2ba08f.html
喔