homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

404 Missing Page Won't Recognize Style Sheet

5+ Year Member

Msg#: 3832207 posted 1:26 pm on Jan 22, 2009 (gmt 0)

My site seems to work fine otherwise but I can't get my missing.htm 404 page to recognize the style sheet. It is in the same base directory as my index.htm page and calls the same stylesheet path. I have also tried the direct URL to the style sheet and nothing works.

If it matters, server is Server version: Apache/1.3.34



WebmasterWorld Senior Member dreamcatcher us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 3832207 posted 3:00 pm on Jan 22, 2009 (gmt 0)

Try adding a base path in your missing.htm page before the stylesheet:

<base href="http://www.example.com/" />

You may need to adjust the path. Alternatively, try using the full path when adding your style.css link. You may also need to adust image urls too in your stylesheet.



WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 3832207 posted 4:10 pm on Jan 22, 2009 (gmt 0)

Also recently discussed here: [webmasterworld.com...]



WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 3832207 posted 4:11 pm on Jan 22, 2009 (gmt 0)

It really depends on where the 404 comes from. For example, you have the following structure:


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,


The error actually comes from the cgi-bin directory, so at that point, it's looking for


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


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,


You would have the same path,

<link rel="stylesheet" type="text/css" href="/css/mycss.css">

as this file.


Move it wherever you like, it will always find the CSS.

Oops, simul-post, JD has it!

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved