Forum Moderators: phranque
On my hosting account you can build custom 404 pages through the cpanel. I have one there and it works fine for any pages in /.
However, I have just made some pages in a subdirectory and I noticed that if a 404 comes up from there the text of the page is all there but the images are not.
Any ideas why this is happening? I already tried to put a separate images file in the subdirectory but it didn't work.
/home/
/home/images/
/home/subdirectory/
When you get a 404 error from inside "/home/subdirectory/", the browser stays inside that directory. But if your 404 page was written with links relative to "/home/", then the page will be looking for images in "/home/images/": "/images/imagename.gif", say. But the URL, because of your being inside the subdirectory, will attempt to resolve as "/subdirectory/images/imagename.gif". Since the file doesn't exist in that location, it can't be displayed.
This is why it is recommended that, for 404 (and other) error pages, you use absolute links. That way, images will display as desired, and you can "pop out" to the correct location when you click a link.
Hope that helps.
Eliz.