Wildcard Virtual Hosts
Setting up wildcard virtual hosts allows you to automatically access each new local WordPress project under its own custom domain (e.g. myproject.test), without manually editing your system’s hosts or web server configuration for every new site. This greatly speeds up local development and keeps your environment organized.
Why use wildcard virtual hosts?
- Zero config: No manual changes for each project—just start coding.
- Custom local domains: Every site gets a memorable, separate
.testdomain. - Professional workflow: Works especially well for multisite and team development.
macOS Setup
Chisel recommends using the dnsmasq tool via Homebrew for wildcard DNS resolution.
This tutorial assumes you have MySQL and Apache installed (they come by default with macOS). If you use MAMP, use it as you like, but this tutorial aims for a built-in Apache & MySQL setup. You can find additional information about where MAMP stores its config files in this article.
Steps:
- Install prerequisites:
Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"BashXcode CLI tools (if not installed):
xcode-select --installBash- Install and configure dnsmasq:
brew install dnsmasq
echo 'address=/.test/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir -p /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'BashOn Apple Silicon Macs, Homebrew’s prefix may be /opt/homebrew instead of /usr/local. Adjust above commands if needed.
- Apache configuration:
Uncomment LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so in /etc/apache2/httpd.conf.
In /etc/apache2/extra/httpd-vhosts.conf add:
<VirtualHost *:80>
ServerAlias localhost *.test
VirtualDocumentRoot /Users/YOUR_USERNAME/Projects/%1/wp
UseCanonicalName Off
<Directory "/Users/YOUR_USERNAME/Projects">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>TextRestart Apache:
sudo apachectl restartBashWindows Setup
Wildcard local domains are supported via Acrylic DNS Proxy:
- Install Acrylic DNS Proxy and follow the included setup guide for your Windows version.
- Edit the Acrylic hosts file (
AcrylicHosts.txt) to include:
127.0.0.1 *.testText- Configure Apache/Vhosts (in XAMPP or similar):
Uncomment LoadModule vhost_alias_module modules/mod_vhost_alias.so in httpd.conf.
In httpd-vhosts.conf, add:
<VirtualHost *:80>
ServerAlias *.test
VirtualDocumentRoot C:/xampp/htdocs/%-1/wp
UseCanonicalName Off
<Directory "C:/xampp/htdocs">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>TextRestart Apache via XAMPP control panel.
Linux Setup
Tutorials for setting up wildcard DNS and Apache vhosts on Linux are available online and follow a similar approach—configure DNS resolution and add wildcard vhost rules in your Apache/Nginx configuration.
Usage
- Projects in your configured directory (e.g.
~/ProjectsorC:/xampp/htdocs) will be available atprojectname.test. - Chisel configures BrowserSync to proxy each site at its respective
.testdomain. - For best results, name your project folder to match the desired domain name.
Tip: Use .test for all local domains. It is reserved for testing by the IETF, making it the safest and most conflict-free choice.