Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm running apache2 on a local server. I use no-ip.com to route DNS to that server through my cable modem. While disconnected from the web and working on localhost my web pages don't render the CSS since WordPress is linking to the absolute domain URL.

In my /etc/apache2/sites-available/default file for this host i have ServerName www.example.com and ServerAlias localhost which isn't working to let me view my site offline

What can I add to my virtual hosts file to render the CSS? Or am I out of luck with WP and my zend application pointing to the domain which is unreachable while offline?

Just a note only after I realized the file paths caused a problem while browsing localhost did I add the ServerName and ServerAlias to try and get it to work.

Thanks

share|improve this question
2  
Have you made your hosts file on your local machine point example.com to localhost? –  paulmorriss Nov 8 '11 at 9:16
add comment

2 Answers 2

  1. Use root-relative paths (/path/to/your.css). These are just as good as absolute paths for most sites, they just allow you to access your assets via multiple hosts.

  2. Add an entry for your domain in your hosts file:

    127.0.0.1       www.example.com

share|improve this answer
add comment

It could be your machine caching the old value for www.example.com

I would flush your DNS and try again.

The other thing to check would be if you are using www.example.com and wordpress is going to example.com then there will be an issue, I would maybe add example.com to your host file along with www.example.com.

share|improve this answer
    
I'm pretty sure it's wordpress when installed it places your domain into it's settings / options db table and uses it when generating the links to the style sheets. –  Anagio Nov 8 '11 at 21:13
    
As it is also happening for their Zend application and works when they are online but not offline, I don't think this is just the domain being called wrong in the Wordpress DB –  Toby Nov 9 '11 at 9:38
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.