Forum Moderators: mack
If it matters, server is Server version: Apache/1.3.34
mydomain.com
mydomain.com/httpdocs
mydomain.com/httpdocs/index.html
mydomain.com/httpdocs/my-404.html
mydomain.com/httpdocs/css/mycss.css
mydomain.com/cgi-bin/myscript.cgi
If your CSS in the 404 is like this,
<link rel="stylesheet" type="text/css" href="css/mycss.css">
And you try calling a non-existent file in the cgi-bin,
mydomain.com/cgi-bin/nonexistent.cgi
The error actually comes from the cgi-bin directory, so at that point, it's looking for
cgi-bin/css/mycss.css
(You can verify this by checking out your error logs.)
You don't need to do a base href (I find these create more havoc than they help . . . at least for me . . . ) if you simply reference all files relative to the domain root, everything will connect properly:
<link rel="stylesheet" type="text/css" href="/css/mycss.css">
That leading forward slash means "start at the domain root" (mydomain.com/httpdocs.) So wherever you move this 404 page, it will connect with mydomain.com/httpdocs/css/mycss.css.
The same is true of all your selectors in the css,
background:url(/images/bg.gif);
and images in your documents
<img src="/images/myimage.gif">
Forming this habit allows you to move files anywhere on your system without having to modify paths. for this file,
mydomain.com/httpdocs/some-directory/some-other-directory/im-buried.html
You would have the same path,
<link rel="stylesheet" type="text/css" href="/css/mycss.css">
as this file.
mydomain.com/httpdocs/index.html
Move it wherever you like, it will always find the CSS.
Oops, simul-post, JD has it!