.htaccess and ErrorDocument 404 & css

Hi,
I have called out on my .htaccess the ErrorDocument 404 going to the absolute path of the error404.php page. However, if I try to go to a non-existent directory or if it is misspelled, I do get my error page but it is not styled and is missing all the images. Why does this happen if on the htaccess doc says:
ErrorDocument 404 http://www.myurl.com/error404.php ?

The website is: http://tinyurl.com/kdsk2qv.

It works fine if the ‘page not found’ is in the root directory where the error404.php page is located.
Thanks so much,
Janell

That’s because the paths to your CSS files are relative. For example, you have


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

If I request yourdomain.com/does/not/exist/, the browser will look for /does/not/exist/style.css, which does not exist, because there is no style.css there, it’s in the root of your domain.
To fix this problem change the line before to


<link href="[color="red"]/[/color]style.css" rel="stylesheet" type="text/css" />

:slight_smile:

Hi ScallioXTX,
Well, it seems that I needed to dig deeper as there is a handle_url.php that overrides the htaccess and it is a different error page that it serves up, not the error404.php. I am now just trying to find out how to make the link in the handle_url.php page send the visitor to the absolute path of the error page, but I don’t really know php, so I am hopefully getting an answer from the folks that wrote the ECT Templates CMS .

Thanks for your help. I did make the images and style sheet absolute paths, but I don’t want to make all the links also absolute (that is now the problem, on the error page all the links try to go to that bad directory to find the page) as that is just more unnecessary code, so I am hoping that by making the path to the error page absolute that should take care of it, … I hope!

Thanks again,
Janell