03 Dec 2016
Setup a Virtual Host in WampServer 3.0
A virtual host (vhost) is recommended to prevent uploading conflicts between your local and live site. It sets the project name as the document root, rather than localhost to avoid directory issues and better match a live server environment. WampServer 3 offers an incredibly easy way to create virtual hosts for your projects.
Virtual Host Setup
- Create a project folder in the www directory (e.g. project1).
- Launch WAMP and navigate to http://localhost/.
- From the Localhost page, Click on Add a Virtual Host at the bottom left.
- Name the Virtual Host name in the first field. Use the same name as the project (e.g. project1). Set the complete path to the project in the third field (e.g. C:/wamp64/www/project1/). Finally, click Start the creation of the VirtualHost (May take a while) button.
Upon completion, you should receive,
The files have been modified. Virtual host project1 was created.
- Restart the DNS:
- Right-click the green WAMP icon
- Go to Tools
- Restart DNS
If you go back to http://localhost/, test to make sure your project can be accessed under Your Projects and that the URL root is the project name instead of localhost. You should also have a new VirtualHost created under YourVirtualHost.
When we created the vhost using the GUI, 2 files were updated: