Custom 404/Error Page

However, once a slash is added after the HTML, it doesn't work.
The page works, nothing on it does. It is trying to find everything in the wrong places. Read up on "absolute" and "relative" URLs and come back. I'll give you a clue - your css file is not at "http://www.tastytreats.org.uk/thispagedoesnotexist.html/css/styles.css" but at "http://www.tastytreats.org.uk/css/styles.css."
 
I understand absolute and relative URL's, yet I still don't understand what's causing the error?
My NotFound page works when it doesn't have a slash at the end, but when it does it doesn't? How can an absolute/relative issue be causing this?
 
I understand absolute and relative URL's, yet I still don't understand what's causing the error?
My NotFound page works when it doesn't have a slash at the end, but when it does it doesn't? How can an absolute/relative issue be causing this?

I think that by adding the / at the end, the page is loading as though it is a new directory. Therefore, from the new directory, the css file would then be found at "../css/style.css" say, rather than just "css/style.css".
 
So is there a fix? Or because it'll always think it's looking in a new directory with a slash then it'll always produce an error?
 
Well, I've got it to work, by putting the "/" in the link to the CSS. But now, none of the links work?
 
Last edited:
You need to make all the links on the 404 page absolute rather than relative.

So the link to the homepage would be

Code:
http://www.tastytreats.org.uk/index.html

rather than just

Code:
index.html

That way, no matter at what directory level the 404 page is showing at it always knows exactly where everything is by following the absolute, unchangeable web address.*

*I think
 
Last edited:
I think I've done it, I also had to have the link to the .css page with a slash in front of it so it could find that too at every level (I think)?

Is it working for you guys? :)
 
Yep works for me to. What about having the link to the stylesheet as an absolute link too?

And the two links in the middle still need changing but you’ve probably seen that already.
 
I've just seen the two in the middle there haha.
I'll also do the sitemap link, forgot all about that.

Are the absolute links only necessary on this page because it can occur in any directory? Whereas the other pages can use relative links because they'll always be on the same level on the site?
 
Back
Top