Puddinq.com sharing knowledge

WP Multisite on Wamp

WP Multisite on Wamp

To develop a WordPress Multisite on a Wamp server some extra steps are needed before you can start with the famous 5 minute installation of WordPress, followed by the steps to initiate the WordPress Multisite.

1. The first step will be to define the wanted domain names to be available in your pc. These domain names need to be added to the host file.

The host file is just a text file without an extension. a common place for it is:

C:\Windows\System32\drivers\etc\host

You need to open notepad ‘as administrator’ to be able to edit it. Once opened you need to select ‘view all files’ because without the extension the explorer window does not show the file. tutorial 

## wp multisite example.com
127.0.0.1     www.example.com example.com

The lines with # are ignored

2. The second step it to create one virtual host om your Wamp. This can be done with the Wamp menu or by directly editing the httpd-vhosts.conf file.

Create a folder with the name of the main domain in your /www/ folder

c:/wamp/www/www.example.com/

Now open your localhost (the wamp main page), and under Tools is a button ‘add a virtual host’. Follow the steps and restart wamp.

3. Now your browser will go to localhost on all usages of *.example.com, but only dev.example.com will forward to the contents of the folder you made.

The next step is to add an alias in the apache virtual host file (httpd-vhosts.conf). The path can be:

C:\wamp\bin\apache\apache2.4.17\conf\extra\httpd-vhosts.conf

But this depends on the wamp installation folder and the apache version. In it you need to add:

ServerAlias *.example.com

<VirtualHost *:80>
	ServerName example.com
	ServerAlias *.example.com dev.example.com
	DocumentRoot c:/wamp/www/example
	<Directory  "c:/wamp/www/example/">
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Require local
	</Directory>
</VirtualHost>