Recently I have been working on a large project that required using the WordPress multisite. WordPress Multisite enables you to create multiple websites from a single installation, requiring only one database and one set of files for many websites. On my macOS devices I use MAMP PRO app by appsolute GmbH for local development and therefore I needed to get MAMP working with WordPress multisite and sub domains. In this tutorial, you’ll learn how to run WordPress Multisite with a MAMP PRO app.
For this I am assuming that you have MAMP PRO app installed, and also WordPress installed and Multisite option already activated.
- Knowledge needed: WordPress
- Requires: WordPress, MAMP PRO, macOS (I use the version 10.12.5)
Now, step by step guide.
Reset MAMP PRO ports
Firstly we need to make sure that MAMP PRO is using the default Apache and MySQL ports (80 and 3306 respectively). To do this, go to the “General” tab from the MAMP window and click the button titled “Set Apache and MySQL ports to 80, 443 and 3306“.
Edit macOS’s hosts file
The next thing to do is to edit your macOS’s hosts file. To do this enter the following into the Terminal app:
sudo open -a TextEdit /etc/hosts
When prompted enter your password and you will then see the hosts file with a list of hosts defined.
Move to the bottom of the list and then enter the domain you want to use locally for your WordPress installation. For this example we are going to use the
multisite.dev. As this is going to be a Multisite installation you will need to add subdomains in here too. Here is an example:
127.0.0.1 multisite.dev 127.0.0.1 subsite1.multisite.dev 127.0.0.1 subsite2.multisite.dev
Note! In the future, before adding and setting up additional subsites in your WordPress Multisite installation you will need to add new subdomains to the macOS’s hosts file.
Restart MAMP PRO by clicking “Stop Server” and then “Start Server” in order to activate the virtual host changes.
That’s it, we’re done. Now we are ready to go with running locally a WordPress Multisite installation on macOS.
Thanks for reading!