I want to create a local network on a Windows machine using subdomains. I do not want to edit the hosts
file for each new subdomain. But Windows does not support wildcard subdomains, and the Codex doesnât say anything useful about this topic.
What should I do?
There is a plugin for that: WP XAMPP Multisite Subdomains. Unfortunately, there is no English description available. Iâll try that here.
The following guide will set up a multi-site under
mu.wp
with subdomains.1. Basic Installation
Start with a fresh installation of WordPress and XAMPP. Create a network for subdomains. Do not create any sub site yet.
My XAMPP is installed in
E:xampp
, WordPress inE:wordpress.latest.final
, and my site specific directories inF:sites
. There is a directoryF:sites_logs
for log files.Make sure to adjust the paths in the following examples to your set up.
2. The
hosts
fileOpen the
hosts
file. On Win 7 thatâs probably onC:WindowsSystem32driversetchosts
, and you need administrator rights to edit it.Create a separate section like this:
Note we use
127.0.0.2
, not127.0.0.1
. This is important.Save the file, close and forget.
3. The
httpd-vhosts.conf
Open the Apache vhosts file in
/apache/conf/extra/httpd-vhosts.conf
.Create a new virtual host. If that is your first virtual host you need a generic vhost first.
generic vhost
Should be the first virtual host in the file.
our multi-site vhost
Make sure all the paths are correct! Restart Apache.
4. Install the plugin
Install the plugin WP XAMPP Multisite Subdomains as a MU-plugin. Usually in
wp-content/mu-plugins
.Done.
You can create new subdomains now in
http://mu.wp/wp-admin/network/site-new.php
, the plugin will update thehosts
file automatically, and your new sites are available immediately.