How to Create a Virtual Host in WAMP

In the new version of WAMP it’s recommended that you use a Virtual Server. The following steps highlight how to do just that:

Step 1:

Create a new project in your www folder, name it anything. For this example I will use MYPROJECT as the folder name.

 

Step 2:

Open: /wamp/bin/apache/apacheX.X.X/conf/httpd.conf and uncomment this line: # Include conf/extra/httpd-vhosts.conf

 

Step 3:

Open: /wamp/bin/apache/apachexxx/conf/extra/httpd-vhosts.conf and add the following code at the bottom:

<VirtualHost *:80>
   DocumentRoot “c:/wamp64/www/MYPROJECT”
   ServerName MYPROJECT
   <Directory “c:/wamp/www/MYPROJECT”>
      AllowOverride All
      Require local
   </Directory>
</VirtualHost>

Note: If you want your site to be served through a different folder, e.g. “MYDIRECTORY” simply add it after the project name without a trailing slash: MYPROJECT/MYDIRECTORY

 

Step 4:

Open: C:\Windows\System32\drivers\etc\hosts (you will need administrative permissions to do this part; if you have antivirus you may have to shut it off temporarily) and then add the following lines at the bottom (uncommented):

127.0.0.1        MYPROJECT
::1        MYPROJECT

Note: Make sure there is at least one space between the IP addresses and your project name.

 

Step 5:

Restart your WAMP server and then load up your project with: http://MYPROJECT/

P.S. An excellent link for more in-depth help is at http://ronangelo.com/how-to-create-a-project-or-virtual-host-with-wamp/

Leave a Reply

Your email address will not be published. Required fields are marked *