TechEarl

Domain Directing and Virtual Host Setup for WAMP Server (and Modern Alternatives)

Set up Apache virtual hosts on WAMP Server 3.3+, map mysite.local to a project folder, fix the port-80 conflicts that ruin Friday afternoons, and enable HTTPS on localhost with mkcert. Plus when to ditch WAMP for XAMPP, Valet, or Docker.

Ishan KarunaratneIshan Karunaratne⏱️ 14 min readUpdated
Set up Apache virtual hosts on WAMP Server 3.3+, map mysite.local to a project folder, fix the port-80 conflicts that ruin Friday afternoons, and enable HTTPS on localhost with mkcert. Plus when to ditch WAMP for XAMPP, Valet, or Docker.
WAMP Server tray icon next to a Windows command prompt showing httpd-vhosts.conf

The default WAMP setup hands you http://localhost/myproject/ and lets you ship code that breaks the moment it leaves your laptop. Hardcoded paths to /myproject/, base URLs full of localhost, database links that need a find-and-replace before deploy. The fix is a virtual host: http://mysite.local maps to your project folder on disk, every URL in the app behaves like production, and the database migration on launch day is just a domain swap. The setup has not changed dramatically since the original WAMP, but Apache 2.4 dropped a few legacy directives, modern dev now expects HTTPS on localhost, and the alternatives (XAMPP, Laravel Valet, Docker) have caught up enough that picking WAMP is a deliberate choice. Here is the refreshed walkthrough for WAMP Server 3.3+ on Windows, plus the parts of the toolchain worth knowing about.

How do I set up a virtual host on WAMP Server?

Three files, two restarts. First, edit C:\wamp64\bin\apache\apache2.4.x\conf\extra\httpd-vhosts.conf and add a <VirtualHost *:80> block with ServerName mysite.local and DocumentRoot "c:/wamp64/www/mysite" (plus a matching <Directory> block with Require local). Second, edit C:\Windows\System32\drivers\etc\hosts (as Administrator) and add 127.0.0.1 mysite.local. Third, confirm Include conf/extra/httpd-vhosts.conf is uncommented in httpd.conf (WAMP 3.3 enables it by default). Restart Apache from the WAMP tray icon (left-click WAMP > Apache > Service > Restart Service), flush the DNS cache with ipconfig /flushdns, and http://mysite.local will serve your project. Repeat the <VirtualHost> block for each additional site.

Jump to:

What WAMP Server looks like in 2026

WAMP Server is still actively maintained by Romain Bourdon (wampserver.com). The current line is WAMP 3.3.x with bundled Apache 2.4, PHP 8.2/8.3/8.4 (you can switch between versions from the tray menu), and MySQL 8 / MariaDB. The default install path moved from C:\wamp\ to C:\wamp64\ years ago, so every path in this guide uses c:/wamp64/, adjust if your install differs.

Two things have changed since the older WAMP docs that float around:

  • Apache 2.4 dropped NameVirtualHost. The legacy NameVirtualHost *:80 directive is gone. In 2.4 you just declare <VirtualHost *:80> blocks and Apache handles the name-based matching itself. If you copy a vhost config from a 2.2-era tutorial, delete the NameVirtualHost line.
  • Apache 2.4 changed authorization syntax. Order allow,deny and Allow from all are deprecated. Use Require local (allow loopback only) or Require all granted (allow anyone). For local dev, Require local is the safer default.

Step 1: enable vhost includes in httpd.conf

Open the main Apache config from the WAMP tray menu:

left-click WAMP icon > Apache > httpd.conf

Find the line near the bottom (around line 540 on Apache 2.4.58):

apache
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Uncomment it:

apache
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Save the file. On WAMP 3.3+ this is enabled by default, check before editing. Confirming this line is uncommented is the difference between a vhost change taking effect and a vhost change being silently ignored.

If you also see legacy NameVirtualHost *:80 anywhere in httpd.conf (common in older configs upgraded over many WAMP versions), delete it. Apache 2.4 logs a [warn] NameVirtualHost has no effect if you leave it in.

Step 2: add a virtual host block

Open the vhost config from the tray menu:

left-click WAMP icon > Apache > httpd-vhosts.conf

Or directly: C:\wamp64\bin\apache\apache2.4.x\conf\extra\httpd-vhosts.conf.

By default it contains the localhost block that maps http://localhost/ to C:/wamp64/www/. Add your project below it:

apache
<VirtualHost *:80>
    ServerName mysite.local
    ServerAlias www.mysite.local
    DocumentRoot "c:/wamp64/www/mysite"
    <Directory "c:/wamp64/www/mysite">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
    ErrorLog "${APACHE_LOG_DIR}/mysite-error.log"
    CustomLog "${APACHE_LOG_DIR}/mysite-access.log" common
</VirtualHost>

Important bits:

  • ServerName, the domain you will type in the browser. mysite.local is conventional. Avoid .dev (Google owns the gTLD and Chrome HSTS-pins it to HTTPS, which breaks plain-HTTP local dev). The .local TLD is reserved and safe.
  • ServerAlias, additional names that match this vhost. Useful for www. variants.
  • DocumentRoot, the absolute filesystem path. Forward slashes work fine on Windows; the colon-after-drive (c:/) is required.
  • AllowOverride All, lets .htaccess files in the project override Apache config. WordPress and Laravel need this.
  • Require local, only allow connections from 127.0.0.1 / ::1. Switch to Require all granted if you need to reach the dev server from another device on the LAN.
  • ErrorLog and CustomLog, per-site logs go a long way when debugging routing issues. Otherwise everything ends up in apache_error.log mixed with every other site.

Save. Apache parses this file on every restart, a typo here means Apache refuses to start. Check apache_error.log (under C:\wamp64\logs\) if WAMP goes orange or red.

Step 3: edit the Windows hosts file

Apache now knows what to do with mysite.local, but Windows still does not know where to find the host. Map it to loopback in the hosts file:

code
C:\Windows\System32\drivers\etc\hosts

You need an Administrator text editor to save changes. The trick that works without fail: right-click Notepad in the Start menu > Run as administrator > File > Open > paste the path above > set the file filter to All Files so it shows.

Add a line at the bottom:

code
127.0.0.1 mysite.local
127.0.0.1 www.mysite.local

Save. Then flush the resolver cache so the change takes effect immediately:

powershell
ipconfig /flushdns

Browsers do their own DNS caching on top of Windows. Chrome's cache lives at chrome://net-internals/#dns and can be flushed from that page if you hit a stale lookup.

Step 4: restart Apache and verify

From the WAMP tray icon: left-click > Apache > Service > Restart Service. The icon goes from orange (restarting) to green (running). If it stays orange, Apache failed to start, check the error log.

Verify with curl or a browser:

powershell
curl -I http://mysite.local
# Expected: HTTP/1.1 200 OK   (or 403/404 depending on what is at the doc root)

If you get HTTP 200, the vhost is working. If you get a DNS error, the hosts file edit did not take (re-flush, or try ping mysite.local to see if it resolves to 127.0.0.1). If you get 403 Forbidden with the right hostname, the <Directory> block is missing or Require local is rejecting your IP, confirm you are connecting from the local machine, not over LAN.

Multiple sites: different domains vs different ports

For each additional site, repeat the <VirtualHost> block with a different ServerName and DocumentRoot:

apache
<VirtualHost *:80>
    ServerName client-a.local
    DocumentRoot "c:/wamp64/www/client-a"
    <Directory "c:/wamp64/www/client-a">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName client-b.local
    DocumentRoot "c:/wamp64/www/client-b"
    <Directory "c:/wamp64/www/client-b">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

And add both to the hosts file:

code
127.0.0.1 client-a.local
127.0.0.1 client-b.local

This is name-based virtual hosting, Apache uses the Host: header in the HTTP request to pick the right vhost. The *:80 is the listen socket (any address, port 80), and ServerName is the discriminator.

If you need two sites on the same hostname but different ports (rare, usually only when one app refuses to play nice with vhosts):

apache
Listen 80
Listen 8080

<VirtualHost *:80>
    ServerName mysite.local
    DocumentRoot "c:/wamp64/www/mysite"
</VirtualHost>

<VirtualHost *:8080>
    ServerName mysite.local
    DocumentRoot "c:/wamp64/www/mysite-admin"
</VirtualHost>

Then visit http://mysite.local and http://mysite.local:8080. Less common; mention it because tutorials in the wild still do.

HTTPS on localhost with mkcert

Modern web work needs HTTPS even locally, Service Workers, secure cookies, mixed-content rules, and most modern OAuth flows refuse to run over plain HTTP. The cleanest way to get a locally trusted cert in 2026 is mkcert by Filo Sottile. It installs a local CA into your system trust store and issues per-domain certs that Chrome, Firefox, and Edge accept without warnings.

Install via Chocolatey or Scoop:

powershell
# Chocolatey
choco install mkcert

# Or Scoop
scoop install mkcert

Then in an Administrator PowerShell:

powershell
mkcert -install
cd C:\wamp64\certs
mkdir -p .
mkcert mysite.local "*.mysite.local"

That writes mysite.local+1.pem and mysite.local+1-key.pem into the current directory.

Enable Apache's SSL module (WAMP tray > Apache > Apache modules > tick ssl_module) and add an HTTPS vhost:

apache
Listen 443

<VirtualHost *:443>
    ServerName mysite.local
    DocumentRoot "c:/wamp64/www/mysite"
    SSLEngine on
    SSLCertificateFile "c:/wamp64/certs/mysite.local+1.pem"
    SSLCertificateKeyFile "c:/wamp64/certs/mysite.local+1-key.pem"
    <Directory "c:/wamp64/www/mysite">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Restart Apache. https://mysite.local now serves with a green padlock, no --ignore-certificate-errors hacks.

If you want an HTTP > HTTPS redirect on local (matching prod behaviour):

apache
<VirtualHost *:80>
    ServerName mysite.local
    Redirect permanent / https://mysite.local/
</VirtualHost>

Cross-platform alternatives to WAMP

WAMP is Windows-only by design. If you also work on macOS or Linux, or want fewer surface areas to maintain, here are the realistic alternatives in 2026:

ToolPlatformStrengthsPick when...
WAMP ServerWindowsOne installer, clear tray menu, easy PHP version switchingYou are Windows-only and want a GUI
XAMPPWindows, macOS, LinuxIdentical experience across platforms, FileZilla and Mercury bundledYou want the same tool across multiple OSes
Laravel ValetmacOS, Valet for Linux existsZero-config per-project HTTPS via dnsmasq, lightweightYou are on macOS and most projects are Laravel or generic PHP
LaragonWindowsLighter than WAMP, automatic vhost provisioning, built-in mkcert-style HTTPSYou want WAMP's role with less config
Docker ComposeCross-platformReal production-like infra, reproducible across the teamYou need to match production exactly, or you have a team
DDEVCross-platformDocker under the hood but PHP-focused with a CLI that abstracts the YAMLYou want Docker's isolation without writing compose files
Homebrew Apache + PHPmacOSNative binaries, no virtualizationYou are on macOS and want the simplest possible stack

My honest take: if you are Windows-only and you like a tray icon, WAMP is fine. If you are on a team that needs the dev environment to match production, switch to Docker (or DDEV if you do not want to write compose files). For solo PHP work on macOS, Laravel Valet is hard to beat, valet park in your code folder and every subdirectory becomes a vhost automatically.

Troubleshooting

WAMP tray icon stays orange (Apache won't start). Open C:\wamp64\logs\apache_error.log. The most common errors are a syntax mistake in your new vhost block (look for [error] AH00526: Syntax error on line X) or a port-80 conflict.

"Port 80 already in use" / AH00072: make_sock: could not bind to address [::]:80. Something else is bound to port 80. Common culprits on Windows: IIS, Skype (older versions), VMware Workstation Server, "World Wide Web Publishing Service". Identify the offender:

powershell
netstat -ano | findstr :80
tasklist /FI "PID eq <PID>"

Then either stop the service (Stop-Service W3SVC for IIS) or change WAMP to listen on a different port (edit Listen 80 in httpd.conf, then update your hosts file and vhosts accordingly).

Browser shows the WAMP "Server Configuration" landing page instead of my site. The Host header is not matching any vhost. Confirm ServerName mysite.local exactly matches what the browser sends. Look in apache_access.log to see which Host header arrived.

"You don't have permission to access this resource" (403). The <Directory> block is missing or Require local is rejecting the connection. Add a <Directory> block for the DocumentRoot with Require local. If you are accessing from a LAN device, switch to Require all granted and tighten with Require ip 192.168.0.0/16.

.htaccess rewrite rules ignored. AllowOverride None is the default in some Apache configs. Set AllowOverride All in the <Directory> block. Confirm mod_rewrite is enabled (WAMP tray > Apache > Apache modules > rewrite_module ticked).

mysite.local does not resolve. Hosts file edit did not save (you opened Notepad without Admin), or Windows DNS cache is stale. Run ipconfig /flushdns. Confirm with ping mysite.local, it should resolve to 127.0.0.1. If it still does not, Notepad probably saved as hosts.txt; check that the file has no extension.

HTTPS shows certificate warning even with mkcert. mkcert -install did not run as Administrator, so the CA is not in the system trust store. Re-run as Admin. For Firefox specifically, mkcert needs Firefox's NSS to be detected, run mkcert -install after Firefox is installed.

What to do next

FAQ

TagsApachePHPWAMPWindowsVirtual HostLocal Developmentmkcert
Share
Ishan Karunaratne

Ishan Karunaratne

Tech Architect · Software Engineer · AI/DevOps

Tech architect and software engineer with 20+ years building software, Linux systems, and DevOps infrastructure, and lately working AI into the stack. Currently Chief Technology Officer at a healthcare tech startup, which is where most of these field notes come from.

Keep reading

Related posts