PDA

View Full Version : 404 Page not Working



GiveMeCoffee
March 6th, 2008, 09:25 AM
I have a 404 error page on my website in the root directory called 'missing.html'. If I type in an address that does not exist -- for example -- www.kirupa.com/dfsdad -- the page will come up. However, if I type in the name of anything other than the root directory it shows up, but all the image links are broken. For example -- www.kirupa.com/dfsdad/sssfdsfd

I searched online and on this forum and found some articles, but none of them are working. Does anyone have an ideas on how I can fix this?

Thanks in advance.

simplistik
March 6th, 2008, 09:38 AM
how are you linking your images? You probably have them doing something like this:


<img src="images/error.gif" alt="" />

you need to make them relative to the root so you need to do


<img src="/images/error.gif" alt="" />

notice the first slash in front of the images folder.

also as a side note, it's good practice to always link everything relative to the root as opposed to relative to the file, because of issues like what you're experiencing now. So in your css you should do the same thing w/ your images, drop all that


background: url('images/image.jpg');
background: url('../images/image.jpg');

and just use


background: url('/images/image.jpg');