Ashith
Ashith

Reputation: 43

404 page not displaying styles

My 404 page is not displaying the way it is meant to be.I have placed my 404 page in the same directory of main index page (http://stthomaschss.com) as 404.html and had written in .htaccess file as

# DO NOT REMOVE THIS LINE AND THE LINES BELOW ERRORPAGEID:QeGuBu
ErrorDocument 404 /404.html

The 404 page is functioning ok if the not found error is in the same directory(http://stthomaschss.com/noexist) but if the error occurs in an other direcrtory such as http://stthomaschss.com/results/noexist the 404 page is not displaying styles linked to it...

Need help.

Upvotes: 3

Views: 884

Answers (1)

StuartLC
StuartLC

Reputation: 107247

Styles are displaying correctly because the browser is looking for the css files in a path relative to the 404 page. Your rendered html contains:

<link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/grid_12.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">

You'll need to change this so that they reference the actual css locations, viz:

http://stthomaschss.com/css/reset.css 

So you should change the css link to an absolute one, i.e.

<link rel="stylesheet" type="text/css" media="screen" href="/css/reset.css">

Upvotes: 4

Related Questions