404 error message url

W

Wim Rafera

Hello!

I want to customize my 404 error message.

In order to provide the best options for the user I need to know the url
that caused the error. How can I find that out from the 404 page with
javascript?

Thanks,
Wim
 
J

Joshua Beall

Wim Rafera said:
I want to customize my 404 error message.

Hmm, with JS? This seems like something that should be done on the server
side. But I am no JS guru.

What webserver are you using? How are you directing them to custom error
documents? On my setup (Apache 1.3.29, PHP 4.3.4), and with an
"ErrorDocument 404 /404.php" in my .htaccess file, I can see the document
they tried to access by looking in $_SERVER['REDIRECT_URL'] and
$_SERVER['REQUEST_URI'].

Additionally, $_SERVER['REDIRECT_ERROR_NOTES'] has a human readable error
message like "file does not exist:
/home/path/to/webroot/bogus/file/request.php"
 
S

SpaceGirl

Wim Rafera said:
Hello!

I want to customize my 404 error message.

In order to provide the best options for the user I need to know the url
that caused the error. How can I find that out from the 404 page with
javascript?

Thanks,
Wim

You can find out as the page that causes the error will appear as the
referer for the 404 page. It depends on your platform how you manage your
server errors. Under IIS (Windows Server), you can define custom error pages
for most errors through the IIS control panel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top