Setup a Virtual Host on WAMP or WAMP64 in 3 Steps
1. Open your Apache configuration file located in E:\wamp\bin\Apache#.#.#\conf\httpd.conf, where #.#.# corresponds to the version of Apache that you are running in WAMP.
- Search for “LoadModule vhost_alias_module” (without the quotes) and uncomment the LoadModule vhost_alias_module modules/mod_vhost_alias.so
- Search for “Virtual Hosts” (without the quotes) and uncomment the Include conf/extra/httpd-vhosts.conf
- Save and close the httpd.conf file
2. Update Your Virtual Host Configuration File
- Open your Apache Virtual Hosts (vhost) configuration file located one directory down from the Apache configuration file directory in E:\wamp\bin\Apache#.#.#\conf\extra\httpd-vhosts.conf.
- Add the configuration for your new vhost.I suggest you to visit the Apache project’s documentation which has a decent explanation of the various configuration directives.
I have included mine below.
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "E:\wamp64\www" ServerName localhost ErrorLog "logs/localhost-error.log" CustomLog "logs/localhost-access.log" common </VirtualHost> <VirtualHost *:80> ServerName destinationnepal.localhost DocumentRoot "E:\wamp64\www\destinationnepal" SetEnv APPLICATION_ENV "development" <directory "E:\wamp64\www\destinationnepal"> DirectoryIndex index.php AllowOverride all Order Allow,Deny Allow from all </directory> </VirtualHost>
- Save and close the httpd-vhosts.conf file.
3. Update Your Windows Hosts File
- Open your Windows hosts file located in C:\Windows\System32\drivers\etc\hosts.
- Add a new entry for the vhost at the end of the line that you created. Mine is destinationnepal.localhost So i added
- Save and close the hosts file.
- Resart All Services in WAMP, pop open a web browser and access your new virtual host. Hurray!!!
hosts file are not directly editable.
1. Click Start , click All Programs, click Accessories, right-click Notepad, and then click Run as administrator.
2. Open the Hosts file, make the necessary changes, and then click Save on the Edit menu.