Why doesn't my local install of WordPress display correctly on my iPhone?
November 28, 2011 9:48 AM Subscribe
Why doesn't my local XAMPP install of WordPress display correctly on my iPhone?
I'm using XAMPP to run WordPress locally on my laptop. Everything works great, but when I view the site on my iPhone, none of the CSS loads, although the content does. I suspect the javascript doesn't load either.
Is this a file path issue? Does mobile Safari not know what to do with the "localhost" part of this path?
http://localhost/wordpress/wp-content/themes/mytheme/style.css
I'm using XAMPP to run WordPress locally on my laptop. Everything works great, but when I view the site on my iPhone, none of the CSS loads, although the content does. I suspect the javascript doesn't load either.
Is this a file path issue? Does mobile Safari not know what to do with the "localhost" part of this path?
http://localhost/wordpress/wp-content/themes/mytheme/style.css
I think, from your phone it's not really localhost, it's, well, notlocalhost... localhost is LOCAL to your laptop, you'd need to give your phone an IP or hostname to look at.
posted by Blake at 9:57 AM on November 28, 2011
posted by Blake at 9:57 AM on November 28, 2011
Response by poster: I did put the proper IP address for my machine into the address bar of mobile safari, but the path the page uses for the CSS is:
[link rel="stylesheet" href="[?php bloginfo('stylesheet_url'); ?]" type="text/css" media="screen" /]
(replaced angle brackets with brackets)
So, the source code points here -
http://localhost/wordpress/wp-content/themes/mytheme/style.css
Which mobile Safari doesn't understand.
posted by deern the headlice at 10:04 AM on November 28, 2011
[link rel="stylesheet" href="[?php bloginfo('stylesheet_url'); ?]" type="text/css" media="screen" /]
(replaced angle brackets with brackets)
So, the source code points here -
http://localhost/wordpress/wp-content/themes/mytheme/style.css
Which mobile Safari doesn't understand.
posted by deern the headlice at 10:04 AM on November 28, 2011
Best answer: You need to set the IP address as the WordPress/Site Address in Settings.
posted by Memo at 10:07 AM on November 28, 2011
posted by Memo at 10:07 AM on November 28, 2011
What memo said. WP will use rhe set site address to access all the resources it needs including css and js.
posted by pyro979 at 10:12 AM on November 28, 2011
posted by pyro979 at 10:12 AM on November 28, 2011
It's not that mobile Safari doesn't understand localhost, it's that 'localhost' always means "this selfsame device". So, the iPhone is looking into its own filesystem for the file (well, it would be if it were running a server, which it's not).
To make it look for the stylesheet on the laptop, the path needs to begin with an IP address, not localhost.
This implies WordPress needs to generate that pathname using the IP address rather than localhost, which probably lives in the settings somewhere.
posted by losvedir at 10:14 AM on November 28, 2011
To make it look for the stylesheet on the laptop, the path needs to begin with an IP address, not localhost.
This implies WordPress needs to generate that pathname using the IP address rather than localhost, which probably lives in the settings somewhere.
posted by losvedir at 10:14 AM on November 28, 2011
Response by poster: Worked perfectly, thank you Memo, et al!
posted by deern the headlice at 10:15 AM on November 28, 2011
posted by deern the headlice at 10:15 AM on November 28, 2011
This thread is closed to new comments.
posted by mikeh at 9:56 AM on November 28, 2011