Log in

View Full Version : Custom 404 page



Sliight
07-18-2007, 10:49 PM
My hosting domain allows me to create a custom 404 page, which I plan to do.

I would like to know if I can use my base template that I use for all pages for this? Or would that cause an issue?

My base template includes menus on left and right, as well as the top. Includes a fair amount of scripts also. I assume since it's really just a web page that the domain redirects tpyos to that this should work fine?

Thanks!

Twey
07-18-2007, 10:50 PM
Yup, it's fine.

Sliight
07-18-2007, 10:56 PM
Heh sweet... thanks :)

Veronica
07-31-2007, 09:07 PM
Depending on how your server is set up, the only problem that may arise with the custom 404 page, is with images. If the images for the custom 404 page are in a specific directory, and you use relative links to them in your base template, on some Unix servers they won't show up if the URL of the unfound page is in a different directory. So you might need to change the paths of the images in the custom 404 to absolute paths.

Twey
07-31-2007, 09:39 PM
Hmm? The browser handles all such things. The server has nothing to do with where the browser looks for images. If an HTML page of any kind (including error pages) says <img src="../image.png" alt="">, the browser will always look in .. for image.png -- it doesn't matter what the server is running.

I think the source of your confusion (or perhaps what you were trying to explain) is that since a 404 page can be accessed from any URL, for example http://www.example.com/rhubarb/crumble/and/custard.html, if you use a relative path such as "images/image.png" from your 404 page the browser will look for http://www.example.com/rhubarb/crumble/and/images/image.png, no matter where on your local filesystem the file may be located. However, this applies to all servers, no matter what OS or software they may be running.

Veronica
08-01-2007, 02:01 AM
Rhubarb custard and crumble...mmmm ... and yeh I didn't explain it well at all.

But I've got sites on a number of hosted servers. On some of them, the 404 page gets read as if it's in its original directory, no matter where the "not found" URL is that it gets called from, even if it's a different directory. So relative paths to images, css, etc all work in the 404.

On other hosted servers (using the exact same set-up for the 404 page), the 404 page gets read as if it's in whatever directory is calling for it, ie the directory of the "not found" page. So if there are relative paths in the 404 to images or css, they won't work. But this only happens with some of the servers, not others. So I'd assumed it was a server difference. And yes, I thought it made no sense.

Twey
08-01-2007, 05:09 AM
Perhaps some of the servers perform a redirect like those that occur on DD when accessing a non-existant page (http://www.dynamicdrive.com/fish/)?

ddadmin, if you're reading this, by the bye, these redirects are an abuse of the 302 status code, and damned annoying to boot.