WordPress Multisite is a method to publish many site on a specific domain. Each Site has it’s own design and its onw dashboard to manage it, but it also has a master configuration.
let’s say we have a website domain called “site-domain.net”. you can configure it in two ways:
- as subdomains: sub1.site-domain.net, sub2.sitedomain.net …
- as subfolders: site-domain.net/sub1, site-domain.net/sub2 …
When you want to have a copy of your website locally, to work on it maybe also offline, you need to have a local webserver with functionalities that support wordpress.
When you work with a local webserver, the default localsite servername is “localhost”. But der are some restrictions to wordpress multisites when working locally. in “Before You Create A Network“, you find the following restrictions:
In the following, we look how to setup a local webserver on windows with WAMP-server.
Configuring WAMP Server locally – Working with Virtual Hosts
The method to work with sumdomains on a localhost is setting up and configuring virtual hosts.
Technically is needs the configuration of two files:
- httpd-vhosts.conf of WAMP Server
- hosts on windows.
Here you define the name of the virtual hosts and the path where the webcontent, e.g. the wordpress installation path, is. There are more settings included.
Depending on how to set it up, you make a virtual host for each domain and subdomain individually, or when working with alias, you can use wildcards.
the default location of httpd-vhosts.conf is, depending of the server version C:\wamp64\bin\apache\apache2.4.41\conf\extra.
In this file you allow windows to find the virtual host by the system. Eack local domain as well as their subdomains require an individual entry.
The hosts file is found at C:\Windows\System32\drivers\etc
A sample configuration on Wamp Server on Windows for local (offline) usage
Subdomains: sub1, sub2
Path of local installation: D:/www/wp_sitedomain
This setup-sample uses the wildcard * for subdomains of sitedomains.local in ServerAlias.
How to set up
When you Use the “Virtual Hosts Manager” of Wamp server, it includes the setup in both httpd-vhosts.conf and hosts.
- With Virtual Hosts Manager, the subdomain wildcard * in ServerAlias can not be set there, you have to edit httpd-vhosts.conf manually, and you even hav to set an entry for each subdomain in “hosts” manually.
- If you don’t want to configure vhosts.conf and hosts manually, you define each domain and subdomain in Virtual Hosts Manager. This will also configure hosts-file with the subdmains. For wordpress multisites with subdomains, the path of installation is the same for site and sub-sites.
last update: 31.03.2020