Serveralias: Server alias. It can be used in Apache to set the domain name received by the VM or to receive the domain name for wildcard resolution. The specific settings are as follows:
1. Set the VM to receive multiple domain names
A virtual host often receives multiple domain name resolutions, such as a virtual host to introduce both doctor-c.net, doctor-c.com two domain names, or two second-level domain names, such as: www.doctor-c.net, www1.doctor-c.net, for this situation, serveralias can be easily used, and the redirection implemented in this method is 301 permanent redirection, open the Apache setting file: httpd. conf.CodeMedium:
<Virtualhost *>
Servername "doctor-c.net" # default domain name;
Serveralias doctor-c.com doctor-c.net www1.doctor-c.net # different domain names are separated by spaces;
DocumentRoot "D: \ wwwroot \ doctor-c.net"
<Directory "D: \ wwwroot \ doctor-c.net">
Options indexes followsymlinks
AllowOverride all
</Directory>
</Virtualhost>
Save the httpd. conf file and restart Apche.
Ii. Receiving wildcard domain name resolution
A virtual host can receive wildcard domain name resolution and is also set through the severalias option. By setting this option, it can not only receive second-level wildcard domain name resolution, but also receive third-level and fourth-level wildcard domain name resolution, the specific settings are as follows:
<Virtualhost *>
Servername "doctor-c.net" # default domain name;
Serveralias * .doctor-c.net # uses * to represent a wildcard domain name. To receive a third-level wildcard domain name resolution, you can write it as follows: * .my.doctor-c.net;
DocumentRoot "D: \ wwwroot \ doctor-c.net"
<Directory "D: \ wwwroot \ doctor-c.net">
Options indexes followsymlinks
AllowOverride all
</Directory>
</Virtualhost>
Save the httpd. conf file and restart Apche.
[Doctor-c.net] synchronous publishing address: http://www.doctor-c.net/2012-02-23/99/