I am trying to use MAMP's built in Xip.io functionality to view a WordPress multisite installation on a local network. I have this working no problem with a WordPress single installation but am struggling with multisite. Just wondered if anyone knew what needed changing in the wp-config file to get this working using multisite as changing database entries isn't really the way forward here.
I have not used MAMP and Xip.io for my local installation, but rather I used XAMPP.
I will explain to you the idea that I did to enable multi-site setup on my computer, and hopefully this would direct you in the right way allowing you an implementation using MAMP. Note that I am using Windows.
Before doing anything, I was planning to have my sub-domain setup for my network, not a sub-directory. Therefore my plan was to have
Therefore, I had to add in my
hosts file the following entries:
127.0.0.1 domain.dev 127.0.0.1 www.domain.dev 127.0.0.1 sub1.domain.dev 127.0.0.1 sub2.domain.dev
Then I updated my virtual hosts file
httpd-vhosts.conf to include the following:
<VirtualHost domain.dev:80> ServerAdmin admin@domaindev DocumentRoot "C:/path/to/wordpress" ServerName domain.dev ServerAlias www.domain.dev <Directory "C:/path/to/wordpress"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> <VirtualHost sub1.domain.dev:80> ServerAdmin firstname.lastname@example.org DocumentRoot "C:/path/to/wordpress" ServerName sub1.domain.dev <Directory "C:/path/to/wordpress"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> <VirtualHost sub2.domain.dev:80> ServerAdmin email@example.com DocumentRoot "C:/path/to/wordpress" ServerName sub2.domain.dev <Directory "C:/path/to/wordpress"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>
Then I, I installed WordPress as usual, single installation.
Then I enabled multi-site with sub-domain as described here and everything worked perfectly.
I got xip.io/nip.io working with WordPress multisite on Laragon (basically equivalent to MAMP, but for Windows).
My basic steps were:
- Create a normal new WordPress site. Let's say your new site's name is "mysite.test"
- Install WP CLI
- From the command line (terminal) run
wp search-replace "mysite.test" "mysite.127.0.0.1.nip.io" --all-tables(or you could set it to xip.io, I haven't seen any difference).
- In the Apache configuration file for your site, change the ServerName to be
mysite.127.0.0.1.nip.ioand ServerAlias to be
*.mysite.127.0.0.1.nip.io) instead of
- Restart Apache.
- Visit mysite.127.0.0.1.nip.io. It should be your site.
- Enable WordPress multisite, choosing the "sub-domain" option.
It's a bit barbaric having to enter such a long URL, but at least I don't have to worry about adding a new DNS entry anymore.
I have had similar issues and contacted Appsolute about it (I have been a user of MAMP PRO for years). The answer I received 'It doesn't work with Wordpress'. But they mentioned that this is an issue they aware of and their own MAMP Viewer for iOS (android?) should work. Which it doesn't. Since reporting this back and answering questions I have not heard from them. I simply switched to Local by Flywheel for Wordpress development. However, I would think that the above answers should help. I have also used a plugin to make all paths relative (Relative Paths). Still doesn't resolve the MAMP xip.io / Mamp Viewer issue, but makes moving/testing a site a little easier. And Wordpress serialized some field where the url is used so any URL change should also accommodate the correct number of letter in the string. Hope this helps