WAMP is a popular web development solution for Apache/PHP websites. It allows you to setup multiple websites and domains on a single server.
How to Create Virtual Host on WAMP
Here are the steps to create virtual host on WAMP.
1. Create Website Folder
Create the root folder for your website at a location of your choice. For our example, we will use the path C:/wamp/www/example1
Also read : Apache HTTP Server vs Apache Tomcat
2. Open WAMP and Create Virtual Host
Start WAMP server, open browser and go to http://localhost to view its dashboard. You will see the following screen.
![create virtual host on wamp](https://fedingo.com/wp-content/uploads/2021/05/screen1.png)
Scroll down the screen and click on “Add a Virtual Host”.
![add virtual host](https://fedingo.com/wp-content/uploads/2021/05/screen-1a.png)
You will see the following screen. Enter domain (e.g. www.example.com) and root location of your website. Please provide absolute path while specifying the root folder of your website (e.g. c:\wamp\www\example1)
![virtual host domain name and root location](https://fedingo.com/wp-content/uploads/2021/05/screen2.png)
Click on “Start the creation of virtual host”.
![start creating virtual host](https://fedingo.com/wp-content/uploads/2021/05/screen3.png)
Also read : How to Create Virtual Host in XAMPP
3. Clear local DNS
To access this virtual host, we need to restart DNS server under WAMP. Open command line and run the following command to do so.
ipconfig /flushdns
You can also right-click WAMP icon in system tray to view the available option menus. Go to tools->restart DNS
![restart dns server](https://fedingo.com/wp-content/uploads/2021/05/screen4.png)
Also read : How to Enable HTTP Strict Transport Security Policy in Apache
4. Restart WAMP
Restart WAMP server to apply changes. Open web browser and visit your domain http://www.example.com. You will see its home page content.
If you want to add multiple virtual hosts on your server, then repeat the above steps again for each virtual host.
That’s it. As you can see it is quite easy to create virtul hosts in WAMP, and run multiple websites with a single instance of server.
Also read : How Does RewriteBase Work in Apache
Related posts:
![](https://fedingo.com/wp-content/uploads/2024/05/db908c05ad732bd197c1eaad1c6675d2.jpeg)
Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.