Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Configure Virtual Host on Windows 10

May 24, 2017

4 Min Read
Reading Time: 4 minutes

Many developers start development in their local environment and then go to a staging environment when the work is done. In many instances, the local environment has minimal resources required for the development. Most of the beginners prefer managed WordPress hosting but developers like to create a website in a localized environment.  If you are working with WordPress, setting up virtual hosts and free XAMPP/WAMP stack is a straightforward task.

XAMPP/WAMP stack ensures that when the time comes to take the project live, the database(s) could be moved easily without any hassle.

In this tutorial, I am going to demonstrate how you can set up and configure virtual hosts for WordPress websites with XAMPP running on Windows 10.

Create the Virtual Host

First, you need to navigate to C:/xampp/apache/conf/extra or wherever your XAMPP files are located.

Apache locationThen, edit httpd-vhosts.conf with any text editor. In my case, I am using Notepad++.

httpd-vhosts file

The file looks something like this:

File look

Delete everything in the file and paste the following code:

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/WordPress"
ServerName WordPress.localhost
<Directory "c:/xampp/htdocs/WordPress">

In the above code:

  • VirtualHost: Most web servers use port 80 as their default port. However, you can change the port to 8080, 8081, etc.
  • DocumentRoot: The folder where files of a site will exist. In our case, the folder name is “WordPress”.
  • ServerName: It is the URL for our virtual host.
  • Directory: It is the directory of our virtual host.

Now, go to Windows > Search > Run and paste the following line:



Next, open Host file in your text editor.

Host File

Add the following line in the Host file.      WordPress.localhost

Edit Code in Host File

Once you are done, check whether wordpress.localhost opens up in your browser.

Virtual Host Result

You can see that the domain has been added successfully. You are now free to run the application of your choice in the virtual host. In my case, I will opt for WordPress.

Why speed is crucial for SEO & UX?

These expert tips will show you how to improve the speed of your WordPress Websites.

Thank You

Your Ebook is on its Way to Your Inbox.

Set up WordPress on Virtual Host

At this point, I am assuming that you have already installed the XAMPP server and have a WordPress website set up.

WordPress Database Changes

Now, it’s time to change the database URL (a very important step configure virtual host).

For this, go to http://localhost/phpmyadmin/ and select your database. In my case, it is “WordPress”.

Select Database

Then go to WordPress > wp_options and change the site URL from http://localhost/WordPress/ to http://WordPress.localhost, and home URL from http://localhost/WordPress/wp-admin to http://WordPress.localhost/wp-admin.


Restart Apache and visit your virtual host URL, in our case it’s “wordpress.localhost” and check whether the domain has been set up successfully.

Restart Apache

Since the setup of Virtual Hosts for WordPress Website with XAMPP is done, here is what the final results would look like:

Virtual Host Result

Final Words

That’s it! I hope you have a clear idea of setting up Virtual Hosts for WordPress with XAMPP running on Windows 10. If you have any queries or suggestions, feel free to ask me via the comment section below.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Start Growing with Cloudways Today!

We never compromise on performance, security, and support.

Saud Razzak

Saud is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform. Saud is responsible for creating buzz, spread knowledge, and educate the people about WordPress in the Community around the globe. In his free time, he likes to play cricket and learn new things on the Internet. You can email him at

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

BFCM 2019