【发布时间】:2011-06-05 20:07:59
【问题描述】:
喂! 我想为将来使用 mod_rewrite 创建的所有子域准备一个动态虚拟主机。所有子域的配置方式几乎相同,所以我想到了使用动态 VH 配置。 我希望每个子域的文档根目录为 /home/user/public_html/subdomainName。
我尝试了以下配置,但没有成功:
<VirtualHost xxx.xxx.xxx.xxx:80>
# get the server name from the Host: header
UseCanonicalName Off
<Directory /home/user/public_html/>
# ExecCGI is needed here because we can't force
# CGI execution in the way that ScriptAlias does
Options FollowSymLinks ExecCGI
</Directory>
RewriteEngine On
# a ServerName derived from a Host: header may be any case at all
RewriteMap lowercase int:tolower
#rule that is suposed to set document root of virtual host!???
RewriteRule ^([a-z-]+)\.domain\.com/?(.*) /home/user/public_html/$1/$2
</VirtualHost>
规则或某事似乎是错误的,它不适用。我以前从未使用过动态 VH,所以我不知道我错在哪里......
【问题讨论】:
-
这个问题更适合serverfault.com
标签: apache mod-rewrite dynamic virtualhost