Testing local server with MAMP/wordpress on mobile device?
I prefer to use DNS to deal with local development for mobile. This way you can still use the same IP address for all your local sites, but have a different name for each one (NameBasedVirtualHosts)
- In general settings WordPress; Change The WordPress address from
localhost to the IP address of your desktop pc/mac (URL) - In the MAMP PRO general tab; Check; via Xip.io (LAN only)and copy that address
- In general settings WordPress Paste the Xip.io addres in Site Address (URL)
- you can acces the mobile devices via;http://localhost.IPAddressOfYourLocalComputer.xip.io
I've been able to make a LAN + IOS testing scheme work on OS 10.11 without changing Mamp Pro (4.5) default ports, or change the domain settings in WP admin. Here's all the relevant bits:
- In Finder set up root folder inside "sites" folder i.e.
~/sites/MAMP-hosted/yourdomain.com
- Ensure your mac is using a static IP address, launch Mamp Pro and in the General tab, select that static IP for
yourdomain.com
in the IP address drop down.localhost
should remain the default: * - In the
yourdomain.com
> Databases tab, select the database foryourdomain.com
(localhost doesn't need to be assigned one) - All remaining General tab settings are default including name resolution, only etc/hosts option checked
- at the bottom, the localhost > document root should point to the "MAMP-hosted" folder, and
yourdomain.com
> document root should point to theyourdomain.com
folder.
then adjust wp-config to look like this:
define('DB_NAME', 'name-of-your-database');/** MySQL database username */define('DB_USER', 'root');/** MySQL database password */define('DB_PASSWORD', 'root');/** MySQL hostname */define('DB_HOST', 'localhost');define( 'WP_SITEURL', 'http://your-static-IP' );define( 'WP_HOME', 'http://your-static-IP' );
http://your-static-IP
should bring up the site on any device on your local network, and http://your-static-IP/wp-login
for admin access.
If you write to the database (publish posts, etc) with wp-admin in that state you may need to do some post migration clean up with a plugin like Velvet Blue to remove that IP address.
I haven't experimented with this particular scheme and MAMP on-board SSL, however it's not difficult to switch back once the site is ready to migrate to its dedicated host.