Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm making a mobile site and I'm using the main computers IP adress to connect to it from the iphone 10.0.0.1/wp

With normal sites it works fine, but the WP site I get is stripped from CSS, JS, and images, only plain text. on the mac and the iphone-simulator it works fine.

Is it something known and configurable?

share|improve this question
    
Can you access the site by typing in the same IP address on the server, eg. "10.0.0.1/wp/";? –  Miljenko Barbir Jun 14 '12 at 16:05
    
@MiljenkoBarbir Yes, it works fine with ip from the same computer –  ilyo Jun 14 '12 at 16:19
add comment

1 Answer

up vote 3 down vote accepted

It may be a conflict between the internal option 'home' or 'siteurl' and the access per pure IP address. WordPress doesn’t use just any server name, there is some redundancy which may get in your way here.

You can try to resolve that by two constants defined in your wp-config.php:

define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
// or
// define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/wp' );

define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
// or
// define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp' );

These constants should outdo the options from the database.

share|improve this answer
2  
This is almost certainly the right answer. Odds are, your CSS/JS/IMAGES are not being "stripped", but are being referenced using whatever domain the site is assigned to on your computer (which your phone can't access properly, but your computer can--which is why it appears to work on your computer via the IP). As an additional note, if you have images embedded in any of your posts, they won't be visible on your phone, even if you implement toscho's fix, as they'll have the domain hardcoded. –  MathSmath Jun 14 '12 at 18:46
1  
@MathSmath Yeah, you’ll need probably a filter for the whole output and strip or replace the server name from all paths. I think I have written a plugin for that, just can’t find it right now. –  toscho Jun 14 '12 at 18:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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