You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by JH Foo <jh...@whatthesite.homeip.net> on 2002/03/16 07:59:18 UTC

retain params while redirecting 404 error to script

Hi guys,

I was wondering if you have any solution to this problem:
Like Hotmail, I am trying to customise a 404 error message to run a Perl script.
So for example if I type http://abc.com/myfile.doc?id=101, Apache should catch this as a 404 error.
I have configured Apache to handle 404 errors via the following:
AllowOverride FileInfo
ErrorDocument 404 /cgi/download.pl
Basically Apache calls the script. But because the script requires a parameter (in the above example, 'id'), the value did not get passed over. 

Is there any solution to this problem? If so, please advise.


Re: retain params while redirecting 404 error to script

Posted by Joshua Slive <jo...@slive.ca>.
JH Foo wrote:
>>>So for example if I type http://abc.com/myfile.doc?id=101, Apache should
>>
> catch this as a 404 error.
> 
>>>I have configured Apache to handle 404 errors via the following:
>>>AllowOverride FileInfo
>>>ErrorDocument 404 /cgi/download.pl
>>>Basically Apache calls the script. But because the script requires a
>>
> parameter (in the above example, 'id'), the value did not get passed over.
> 
>>>Is there any solution to this problem? If so, please advise.

When running into these types of problems, it is always best to see ALL 
the variables that apache is giving you.  For example, try pointing your 
ErrorDocument 404 at /cgi-bin/printenv or a similar script.

If you did this, you would see that the QUERY_STRING from the original 
request is available in REDIRECT_QUERY_STRING.

It would be nice if this was documented.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: retain params while redirecting 404 error to script

Posted by JH Foo <jh...@whatthesite.homeip.net>.
Hello Stephen,

Thanks for replying to my question. Can you elaborate on mod_rewrite?

----- Original Message -----
From: "Stephen Reppucci" <sg...@logsoft.com>
To: <us...@httpd.apache.org>
Sent: Saturday, March 16, 2002 9:10 PM
Subject: Re: retain params while redirecting 404 error to script


>
> Sounds like a job for mod_rewrite...
>
> On Sat, 16 Mar 2002, JH Foo wrote:
>
> > Hi guys,
> >
> > I was wondering if you have any solution to this problem:
> > Like Hotmail, I am trying to customise a 404 error message to run a Perl
script.
> > So for example if I type http://abc.com/myfile.doc?id=101, Apache should
catch this as a 404 error.
> > I have configured Apache to handle 404 errors via the following:
> > AllowOverride FileInfo
> > ErrorDocument 404 /cgi/download.pl
> > Basically Apache calls the script. But because the script requires a
parameter (in the above example, 'id'), the value did not get passed over.
> >
> > Is there any solution to this problem? If so, please advise.
> >
> >
>
> --
> Steve Reppucci                                       sgr@logsoft.com |
> Logical Choice Software                          http://logsoft.com/ |
> =-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: retain params while redirecting 404 error to script

Posted by Stephen Reppucci <sg...@logsoft.com>.
Sounds like a job for mod_rewrite...

On Sat, 16 Mar 2002, JH Foo wrote:

> Hi guys,
>
> I was wondering if you have any solution to this problem:
> Like Hotmail, I am trying to customise a 404 error message to run a Perl script.
> So for example if I type http://abc.com/myfile.doc?id=101, Apache should catch this as a 404 error.
> I have configured Apache to handle 404 errors via the following:
> AllowOverride FileInfo
> ErrorDocument 404 /cgi/download.pl
> Basically Apache calls the script. But because the script requires a parameter (in the above example, 'id'), the value did not get passed over.
>
> Is there any solution to this problem? If so, please advise.
>
>

-- 
Steve Reppucci                                       sgr@logsoft.com |
Logical Choice Software                          http://logsoft.com/ |
=-=-=-=-=-=-=-=-=-=-  My God!  What have I done?  -=-=-=-=-=-=-=-=-=-=


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org