Skip to content
WampServer logo WampServer
  • Home
  • What is
  • Features
  • Install
  • Compare
  • FAQs
  • Guide
Get WampServer

How to Create a Virtual Host in WampServer

Create Virtual Host in WampServer

WampServer project addresses like localhost/myproject can get frustrating fast. Links break, paths behave differently from a live site, and testing several projects becomes messy. A virtual host fixes this by giving each project its own clean domain, such as myproject.test, that behaves like a real website. This guide shows you how to create one in WampServer on Windows 10 and 11, step by step, and fix the errors beginners hit most often.

If WampServer is new to you, read what WampServer is and how it works first for the basic concepts. If it is not installed yet, follow the guide to download and install WampServer on Windows before continuing, because every step below assumes a green WampServer tray icon.

Why Use a Virtual Host in WampServer?

A virtual host lets Apache serve a separate website for a specific domain name, even though everything runs on one computer. Instead of stacking projects under localhost, each project gets its own folder and its own browser address.

This matters for three reasons. First, WordPress and most frameworks expect to run from a domain root, so a virtual host reproduces your live server accurately. Second, clean domains keep client projects, test sites, and experiments separate. Third, bookmarks and testing stay organised when every project has a memorable name.

Use a domain ending in .test. That extension is reserved for testing, so it never clashes with a real public website.

Before You Create a Virtual Host

Preparation takes two minutes and prevents most problems:

  • WampServer is running and its tray icon is green, meaning Apache and your database started without errors.
  • You know your project folder, normally inside C:\wamp64\www.
  • You can edit files as an administrator, because the Windows hosts file will not save without elevated permission.
  • You have chosen a unique local domain, for example shop.test, that no other project uses.

Checklist: What a Virtual Host Needs

ItemExamplePurpose
Project folderC:\wamp64\www\shopStores the site files
Local domainshop.testAddress typed in the browser
Hosts file entry127.0.0.1 shop.testPoints the domain to your PC
Virtual host entryCreated by WampServer toolTells Apache where files live

WampServer includes a built-in tool that creates the Apache side for you, which is safer than editing configuration by hand. The steps below use that tool, then cover the manual method briefly.

Steps to Create a Virtual Host in WampServer

Step 1: Create Your Project Folder

Open C:\wamp64\www and create a folder named after your project, for example shop. Place your site files inside it, or a simple test index.php file for now. Folder and domain do not have to match, but keeping them similar helps later.

Step 2: Open the Virtual Hosts Tool

Many WampServer 3.x installs expose the tool from the localhost homepage: start WampServer, open localhost in your browser, and look under Tools for the link to add a virtual host. That page presents a form instead of raw configuration, which is the recommended route.

Step 3: Fill In the Virtual Host Form

Complete the form carefully:

  1. Enter your domain, for example shop.test, without http:// before it.
  2. Enter the full folder path, for example C:\wamp64\www\shop, as the document root.
  3. Leave the IP field empty unless you have a specific reason to bind the site. The default is correct for local development.
  4. Submit the form. WampServer writes the Apache entry and, in many setups, offers to update the Windows hosts file for you.

Step 4: Update the Windows Hosts File

If the tool did not update the hosts file, do it manually. Type Notepad in the Windows search, right-click it, and choose Run as administrator. Open C:\Windows\System32\drivers\etc\hosts and add this line at the end:

127.0.0.1 shop.test

Save the file without any extension. If Windows refuses, you opened Notepad without administrator rights — repeat this step correctly.

Step 5: Restart WampServer Services

Left-click the tray icon and choose Restart All Services. The icon should pass through orange and settle on green. Restarting is essential because Apache only loads virtual host definitions when it starts.

Step 6: Test the Virtual Host in Your Browser

Visit http://shop.test in your browser. You should see your project's homepage or test file; a WordPress install in the folder should load under the clean domain. Open a private window if the old localhost version keeps appearing.

How to Create a Virtual Host Manually

The manual method helps when you need to customise or repair a host. WampServer stores Apache virtual hosts in httpd-vhosts.conf inside the Apache conf\extra folder. A typical entry defines the document root, the server name matching your domain, and local access permissions.

Keep a backup before editing: one typing error can stop Apache entirely, which is why the built-in form is better for standard setups. The concept — one name, one folder, one configuration block — is the standard virtual hosting model used by web servers everywhere.

Common Virtual Host Errors and Fixes

The most common error is a domain loading the default WampServer homepage instead of your project. Usually the hosts file entry is missing, or Apache was not restarted after the change.

An orange icon after restarting means Apache failed to start, often from a syntax error in a manually edited file or a port 80 conflict. Restore your backup, restart, and re-apply changes one at a time.

If the browser says the site cannot be reached while the icon is green, check the hosts file and browser cache. Confirm the domain spelling matches exactly in the hosts file, the virtual host entry, and the address bar.

Frequently Asked Questions

How many virtual hosts can I create in WampServer?

There is no practical limit for normal development. Create one per project, as long as each has a unique domain and its own folder.

Should I use .test, .local, or .dev for local domains?

Use .test — it is reserved for testing and never becomes a real public extension. Avoid .dev, a real extension whose enforced secure-connection behaviour causes confusing local errors.

Do I need to restart WampServer after adding a virtual host?

Yes. Apache reads the configuration at startup, so use Restart All Services after any change and confirm the icon returns to green before testing.

Can a virtual host point to a folder outside www?

Yes. The document root can be any folder, as long as the path is correct and Apache can read it. Many developers keep projects in a separate work folder this way.

Conclusion

Creating a virtual host turns a cramped localhost subfolder into a clean, realistic local domain. Create the folder, use the built-in tool, confirm the hosts file entry, restart services, and test — five habits that work for every project. Repeat the process for each new site and your local workflow stays as organised as your live portfolio.

WampServer

WampServer simplifies local web development on Windows with essential resources for downloading, installation, configuration, server management, and troubleshooting to ensure a smooth development experience.

Navigation

  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 | WampServer | All Right Reserved

Disclaimer: Not affiliated with WampServer or any other third-party platforms