Localhost Wildcard Subdomains

Nearly three years ago (and one of my most popular posts) I wrote a small tutorial on Setting up Virtual Hosts for WordPress Multisite with XAMPP running on Windows 7. Part of that tutorial was to help myself and the other was to help others. I spent quite a bit of time trying to get the newly released WordPress Mulitsite working with sub-domains, in particular localhost wildcard subdomains.

I’ve since moved away from a windows powered machine, but the process for setting up virtual hosts for WordPress on a localhost remains about the same. You need to find where your httpd-vhosts.conf file is located.

Multisite Development

This was always an issue I ran into, and until today never found a solution (I also wasn’t looking that hard). But I’m in the process of moving some old sites into a network and wanted to do some local development and testing of “single site to multisite” database migration without overhead and live site breakage.

Getting Localhost Wildcard Subdomains working

As I wrote previously, or as most posts around the web pointed out, you had to add each domain as a subdomain. That’s a pain, so I usually ended up doing one or two subdomains or forcing the localhost development site as a subdirectory site.

The important line is the ServerAlias with the current domain and then the wildward like so:

ServerAlias thefrosty.dev *.thefrosty.dev

Just be sure to change thefrosty.dev to your domain.

The “full code”