Pages: [1]   Go Down
Send this topic | Print
Author Topic: Custom error pages help  (Read 432 times)
iStealth
Member
*
Offline Offline

Posts: 12


WWW
« on: September 24, 2008, 05:41:48 AM »

i have it all set up and it works great when im directing to the actual folder of the pages

click me

but if i access it by typing in a random directory (replicating an invalid address) none of the images show up, can anyone help?
Logged
Busman
Genetically Modified
Global Moderator
Advanced Authority Member
*****
Offline Offline

Posts: 1481



« Reply #1 on: September 24, 2008, 05:51:38 AM »

That's because you have used relative URLs in your 404 page.

When the 404 is invoked from root, the /images path is OK.
When the 404 is invoked from a subdirectory, the path fails.

Easy solution.. put this in the <head> section of your 404 document..

<base href="http://s-designs.110mb.com/error/"/>

That explanation is not up to my usual standard, but the solution should be good.
« Last Edit: September 24, 2008, 06:00:14 AM by Busman » Logged

Hard drive failures are unavoidable.
Anybody who says they are 'inevitable' is talking crap.
iStealth
Member
*
Offline Offline

Posts: 12


WWW
« Reply #2 on: September 24, 2008, 06:10:23 AM »

Works perfectly now, thank you
Logged
warwound
Hyper-Active Member
***
Offline Offline

Posts: 133


WWW
« Reply #3 on: September 24, 2008, 05:30:34 PM »

I had this exact same problem too.

Using an absolute URL for the location of the 404 error page made all links on the 404 page work but didn't pass the (not found) URL of the original request to the 404 page.

Using a relative URL for the 404 page location meant the URL of the requested but not found page was passed to the 404 page so i could display it in the 404 page but then links on the 404 page failed as described by Busman.

My solution was to use a relative URL for the 404 error page, the 404 error page was passed the URL that was not found and then the 404 page redirected to itself with an absolute URL passing the URL of the original not found page to itself.

It works but is a bit clumsy and probably a waste of server resources - so i'll be rewriting my 404 page later today and trying the html BASE tag trick to see if it works better than my existing technique.

Thanks for the tip  smiley

warwound
Logged

Need a freelancer or a Google Maps API developer?
See: http://googlemapsapi.martinpearman.co.uk/developer/
Pages: [1]   Go Up
Send this topic | Print
Jump to: