The implementation of Wampserver configuration of multiple domain names mainly by modifying the Apache configuration file httpd.conf, modify httpd-vhosts.com file, modify Hosts file and so on. Please read the details below.
Before learning to cross domain, I wrote an article called Wampserver under the use of multiple-port access, the default localhost is 80 port, can use the core of multiport access is to create a new port, that is, a new HTTP service, so we in Apache Configuration file, you can create a new service file that points to port 8080, and then create a new folder (to store the code) and start the service, OK.
Today I want to talk about how to achieve a multiple domain name configuration, General Wampserver after installation will have a WWW folder, inside the new file can be used localhost + relative address to access, but for example, I created a new name in the WWW named Google folder, we can Use localhost/google/to access the files in this folder or folder, but I have to use www.google.com to access, how can I do it?
In fact, this is much simpler than the previous multiport access.
1, modify the Apache configuration file httpd.conf
First we open the Apache configuration file httpd.conf, for example, I found this line under the F:\wamp\bin\apache\Apache2.2.17\conf folder:
#Include conf/extra/httpd-vhosts.conf
Remove the note (delete the front number).
2. Modify httpd-vhosts.conf File
Open the httpd-vhosts.conf file under the F:\wamp\bin\apache\Apache2.2.17\conf\extra folder, plus a paragraph such as:
<virtualhost *:80>
DocumentRoot "F:\wamp\www\google"
ServerName www.google.com
Serveralias google.com
</VirtualHost>
3, modify the Hosts file
Open the C:\WINDOWS\system32\drivers\etc\hosts file and add a sentence:
127.0.0.1 www.google.com
4, new Google folder
Create a new folder named Google in the WWW folder and add an arbitrary file to it, such as index.html, which can be accessed using www.google.com/index.html.
5. Modify httpd-vhosts.conf file again
At this point if you go to visit localhost, you will not be able to access, you need to modify the httpd-vhosts.conf file, add:
<virtualhost *:80>
DocumentRoot "F:\wamp\www"
ServerName localhost
</VirtualHost>
Then visit localhost/index.html, OK!
Other
When looking for relevant information, the discovery basically adds this step, that is, in the httpd.conf file, find this paragraph:
<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Deny from all
</Directory>
Modify it to:
<directory/>
Options FollowSymLinks Includes
AllowOverride None
Order Deny,allow
Allow from all
</Directory>
But I did not change and can have effects, if the above steps do not achieve the desired results, you may try to add this step.
The above content is this article to everybody to introduce wampserver how to configure the multiple domain name, hoped everybody can like.