Testing local server with MAMP/wordpress on mobile device?

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…

Read More
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

Related posts

2 comments

  1. I use xip.io for this.

    What is xip.io?

    xip.io is a magic domain name that provides wildcard
    DNS for any IP address. Say your LAN IP address is 10.0.0.1. Using
    xip.io,

            10.0.0.1.xip.io   resolves to   10.0.0.1
        www.10.0.0.1.xip.io   resolves to   10.0.0.1
     mysite.10.0.0.1.xip.io   resolves to   10.0.0.1
    foo.bar.10.0.0.1.xip.io   resolves to   10.0.0.1
    

    Use a static IP address for DHCP:

    static dhcp IPv4 Address 192.168.1.101

    In MAMP PRO, select the host1 you want to use (wp99.dev in this example), and in the Advanced tab use the following as ServerAlias for the general settings:
    1 instructions for Apache too in the linked article

    ServerAlias wp99.*.xip.io

    Before applying the changes and restarting the servers in MAMP, change the settings of the site:

    http://wp99.192.168.1.101.xip.io

    Save the changes in WordPress, restart the servers in MAMP, login to the site.
    Test on any device/computer of the local network.


    Instead of changing the site settings, an interesting technique to use in wp-config.php:

    require_once('/path/to/Browser-Detection/b5f-browsers.php');
    if( b5f_browser_check( 'mobile' ) )
    { 
        define( 'WP_HOME', "http://wp99.{$_SERVER['SERVER_ADDR']}.xip.io");
        define( 'WP_SITEURL',"http://wp99.{$_SERVER['SERVER_ADDR']}.xip.io");
    }
    

    This way, the desktop version keeps the nice address, and when viewing in mobile the xip.io address is served.

    Here’s a Gist for the file b5f-browsers.php, which uses Chris Schuld’s Browser.php class.


    Related:

Comments are closed.