0

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

closed as off topic by anu, Wyck, fuxia May 5 '13 at 21:40

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • if you've used absolute urls like http://something.com/some... then probably you'd have to change everything. But if you've used relative urls then including site_url('ip_here:port') might be usefull. If you declare site_url() in wp-config then you can use it to add scripts and css. – SachinGutte May 5 '13 at 16:56
4

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:

  • 1
    Awesome tutorial. A pity it's attached to a question that was marked as "off topic". Thanks anyway! – pixeline Sep 20 '13 at 8:03
  • 1
    @pixeline, yep, and I knew it was off-topic, but couldn't avoid publishing ;) Just updated with a wp-config technique for not using that ugly xip.io address in the desktop. – brasofilo Sep 20 '13 at 22:19
0

Have answered my own question, found this great article which did the trick http://www.designshifts.com/view-local-wordpress-website-on-your-iphone-or-ipad-with-mamp/

  • Link only answers are discouraged. Please edit this so that it contains all of the relevant information. – s_ha_dum May 5 '13 at 15:06

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