Unix Programming - ErrorDocument question

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2004 > ErrorDocument question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ErrorDocument question
Derf

2004-05-18, 1:36 am

I am not a Unix server admin, just a user on a shared system, and I'm not
sure of the best group to ask this question, but I would like to edit my
..htaccess 404 redirect so that it captures the pathname of the URL (i.e.
for http://www.example.com/pathname.html I would want to capture the
'pathname.html' portion of the URI). I am thinking I could pass it on this
way: http;//www.mysite.com/404.html?pathname.html

Is there a way I can capture all or part of the requested URL in a variable
I can then tack onto the ErrorDocument string in the .htaccess file?

Thanks for any help!

Derf
Ian Wilson

2004-05-18, 9:18 am

Derf wrote:
> I am not a Unix server admin, just a user on a shared system, and I'm not
> sure of the best group to ask this question, but I would like to edit my
> .htaccess 404 redirect so that it captures the pathname of the URL (i.e.
> for http://www.example.com/pathname.html I would want to capture the
> 'pathname.html' portion of the URI). I am thinking I could pass it on this
> way: http;//www.mysite.com/404.html?pathname.html
>
> Is there a way I can capture all or part of the requested URL in a variable
> I can then tack onto the ErrorDocument string in the .htaccess file?
>


You don't mention the web server but since you say Unix I'll assume
Apache. It would be useful to know the version.

Any request for a nonexistent page will normally be logged in the Apache
error log. Many hosting copmanies provide their customers with access to
the error log - check your hosting control-panel.

If you dont have access to the error log but do have access to CGI or
PHP then you can write a custom error handler to deal with 404 "document
not found" errors.

http://httpd.apache.org/docs-2.0/mo...l#errordocument

Derf

2004-05-18, 4:47 pm

Ian Wilson <scobloke2@infotop.co.uk> wrote in news:c8cjf3$c2o$1
@titan.btinternet.com:

> http://httpd.apache.org/docs-2.0/mo...l#errordocument


Yes, It is Apache ( Apache/1.3.29 (Unix) ). That link did not answer my
question, but the next link it refered to did!

http://httpd.apache.org/docs-2.0/custom-error.html

ErrorDocument 404 /404.html?REDIRECT_URL

works perfectly! Thanks!
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com