Search code examples
apachelightbox2

Lightbox dosen't work with Server Apache


I'm having a problem. I'm using lightbox2 to display images and everything works fine on my local machine. However, as soon as I upload to my server it doesn't work. My servers uses Apache

Anyone come across this?

Using Firebug on Firefox displays this error:

<link rel="stylesheet" href="css/lightbox.css">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /css/lightbox.css was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
</link>

Thanks :)


Solution

  • Path issue: What you want is relative to the document root.

    So Apache gets the document root from an absolute path setting (set in the panel, default: /home/USER/DOMAIN/), then everything is relative from that point.

    Ex: document root: /home/username/website.com relative path to css: assets/css/lightbox.css absolute path to css (which won't work from a browser but will work for commands issued on the server such as cp: /home/username/website.com/assets/css/lightbox.css

    For testing if you put <link rel="stylesheet" href="http://website.com/css/lightbox.css">, it should work.