Set up Virtual Host with WAMP

In this tutorial, I will show you how to set up new WordPress site anywhere on your computer and give them a custom domain by making a virtual host

On my previous tutorial, we discussed how to setup and install WordPress locally with WAMP.

And we are able to access a web page with localhost/, But this is not looking authentic and what if I want to access my webpage with custom URL?

It is possible with WAMP by setting up a virtual host. With virtual host setup you can place your file anywhere you want not necessarily inside www folder.

First Go to localhost on your web browser make sure you have started your WAMP Server
If you see a screen like this :

virtual host

Scroll down to tools section and click Add a Virtual Host.

virtual host

  1. Provide domain name.
  2. Provide an absolute path for the folder which has WordPress.
  3. You can also give a unique IP.

Before setting this up, place WordPress into a new folder

I will create a folder inside downloads/mysites/traveldiary

Copy the path paste to virtual host setup. Now I am pointing my virtual host to the folder that contains my WordPress site.

Wamp

Click on start creating a virtual host

virtualHost

To access, we have to restart DNS server under WAMP

Go to system tray click green WAMP icon right click on it-> go to tools -> restart DNS

vhost_wamp

This will restart the domain name server that is running inside WAMP. Now copy the domain name and paste that into a browser.

Recheck your virtual host

Go to wamp icon -> click -> Your virtual host

Managing Virtual \host:

If you want to edit or delete virtual host?

When you see virtual host there is no way to actually delete it. The best way to delete virtual host is to go to a configuration file that sets up a virtual host.

For configuration file go to localhost on URL -> goto add a virtual host

Wamp

At the top, you will see apache virtual host path copy that path and goto that folder
F:\wamp64\bin\apache\apache2.4.27\conf\extra

Open file httpd-vhosts.conf

vhost

You will see the configuration for myfirstweb.dev if you delete this part and restart your DNS you will get rid of unwanted virtual host setup

Note: you cannot rename the virtual host from here. If you do so will break down everything. If you want to rename just remove and create again.

 

Set up Virtual Host with WAMP

Leave a Reply

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