When we are developing locally. Usually in the browser input http://localhost/project directory name test Web files, you have not thought in the local browser, enter the name of their own set into the project directory, name related issues.
For example, I want to configure a primary domain name www.test.com and a level two domain name img.test.com (in fact, the two-level domain name is the same as configuring another separate domain name)
The
first step: Open the Local System installation folder, for example, I installed WINDOWS8, installed on the C drive, into the folder C:\Windows\System32\drivers\etc
Find a file called hosts and open it with Notepad:
Add the following code at the end of the file:
127.0.0.1 www.test.com127.0.0.1 www.test.com127.0.0.1 localhost
Save when you are finished typing.
Step Two: open Apache installation location, as I use Wampserver. The installation folder is: D:\wamp\bin\apache\Apache2.2.21
Open a directory called Conf, which is the Apache configuration directory
Open a file called httpd.conf
Search for Directory and find one such as: <directory "d:/wamp/www/" >
A row. After you see the code
Put the code:
Order Deny,allow deny from all to 127.0.0.1
Change to:
Order Allow,deny allow from all
Step Three:
In the httpd.conf file just now. Search for include conf/extra/httpd-vhosts.conf
remove the # in front of it. Then save this file
Fourth Step: Open the Conf folder next subfolder: Extra, find a httpd-vhosts.conf this file. Usually the last file,
at the end of the file, add:
<virtualhost *:80> documentroot "d:/wamp/www/test" ServerName www.test.com </VirtualHost> < VirtualHost *:80> documentroot "d:/wamp/www/test/img" ServerName img.test.com </VirtualHost> < VirtualHost *:80> documentroot "d:/wamp/www/" ServerName localhost </VirtualHost>
This basis folder according to their own Apache Files folder to adjust their own, my Apache working folder for d:/wamp/www/, changed to their Apache working folder can be.
A final step. Restart Apache, enter your browser: www.test.com will appear test default content Directory
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
Apache local multi-domain configuration (wampserver local multi-domain configuration)