Mobile app version of vmapp.org
Login or Join
Annie201

: Apache2 virtual host localhost doesn't render CSS when offline because of absolute path I'm running apache2 on a local server. I use no-ip.com to route DNS to that server through my cable modem.

@Annie201

Posted in: #Apache #Css #HttpdConf #Localhost #Virtualhost

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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Annie201

2 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

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.
Add an entry for your domain in your hosts file:


127.0.0.1       example.com

10% popularity Vote Up Vote Down


 

@Eichhorn148

It could be your machine caching the old value for example.com
I would flush your DNS and try again.

The other thing to check would be if you are using 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 example.com.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme