apache 中 ServerAlias让多个域名绑定到同一空间

在apache的虚拟主机中,如果书写了。ServerAlias www.cq.com www.gd.com这样的语句,就可以给虚拟主机增加多个域名,而且这些域名都访问同一个站点。

#Listen 81

ServerName www.bj.com:80
ServerAdmin webmaster@localhost
DocumentRoot "F:/webserver/htdocs/host"
ServerAlias www.cq.com www.gd.com
ErrorLog "logs/host-error.log"
CustomLog "logs/host-access.log" common

Options Indexes FollowSymLinks Includes
IndexOptions FancyIndexing ScanHTMLTitles
AllowOverride All
Order allow,deny
Allow from all

ScriptAlias /cgi-bin/ "F:/webserver/htdocs/host/cgi-bin/"

AllowOverride None
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all



上面的代码会让三个域名都访问到同一个空间。