9

I am currently developing a wordpress site locally using MAMP PRO, which obviously involves using a local database.

I would like to test this site on my iPhone via a remote link. I have managed to do this by typing the following into my mobile phone URL...

192.234.2.32:8888 

(IP Address : Port number)

The problem is the index page is displayed but with no CSS styling. Then when I click on another page, it says the page cannot be found

It seems it has connected to the server properly, but not to the wordpress database. (at least I think this is the problem)

Does anyone have any information on how to get this working or point me in the right direction? Do you need another application to do this, or can it be done with mamp/IP address etc?

Thanks in advance

2
  • 1
    Please, don't cross-post your question in the network.
    – brasofilo
    May 5, 2013 at 22:40
  • I wouldn't normally, but wasn't sure which one to put it in, as it covers both wordpress and normal local development (not wordpress related)
    – Adam
    May 6, 2013 at 15:57

5 Answers 5

1

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)

1
  • 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

screenshot Wordpress enter image description here

0

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 for yourdomain.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 the yourdomain.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.

0

First you need to enable Mamp Viewer in your Mamp Pro.

enter image description here

Then you need to install Mamp Viewer on your mobile.

Your Mamp Server and your mobile need to be in the same network.

So you can view your website in your mobile via mamp viewer or mobile browser with your local domain for example test.local.

-3

you can do this by simply editing the hosts file on your mac.

Or use a tool like https://www.macupdate.com/app/mac/40003/hosts

Point all your domains to the IP of the MAMP host computer, and put the mamp web service on port 80.

use www.domain.dev or similar for the domain names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.