> On Date: Mon, 28 Nov 2005 10:06:24 -0500, Michael Peters
> <[EMAIL PROTECTED]> wrote:
>>
>> David Emery wrote:
>> > On Date: Sun, 27 Nov 2005 16:08:50 -0800, "David Christensen"
>> <[EMAIL PROTECTED]> wrote:
>> >
>> >>I'm sure this has been asked before, but I can't seem to find the
>> question or
>> >>the answer -- how do I direct all incoming requests to a single CGI
>> script on
>> >>Apache 1.3?
>> >
>> > With mod_rewrite, something like this should do it.
>> >
>> > RewriteEngine On
>> >
>> > # If you want it to redirect only in the case where there is no real
>> > # file or directory at the requested location, then un-comment the
>> > # following two lines
>> > ##RewriteCond %{REQUEST_FILENAME} !-f
>> > ##RewriteCond %{REQUEST_FILENAME} !-d
>> >
>> > RewriteRule ^(.*) myscript.cgi
>>
>> While this is cool, I'm not sure that it wouldn't cause other problems.
>> For
>> instance, all bad links etc, would not result in a 404, but rather be
>> redirected
>> to your script which will then probably emit a 500 error since it's not
>> prepared
>> to handle a request for /non_existant.gif.
>
> Hey, he said "all requests" ;) Good point, though - I hadn't thought
> of that.
>
> I should have added the caveat that I haven't actually used this myself.
>
>> Maybe instead of checking for the existence of the file, maybe you
>> should check
>> it's type, or extension.
>>
>> > There might also be a way to do something similar to this without
>> > mod_rewrite.
>>
>> You could write a custom perl handler and do the redirection, etc
>> yourself. But
>> as far as I know, this needs to be done at the apache level (ie, using
>> mod_perl,
>> mod_rewrite, httpd.conf etc) and can't simply be done at the perl level.
>> So if
>> you don't have access to the apache running (ie, shared hosting) then
>> you're out
>> of luck.
>
> I was thinking along the lines of it maybe being possible by
> using/abusing some regular Apache config param like "script alias" or
> "directory match". I just didn't have time to look it up - I'm sure
> the original questioner can read the Apache manual as well as I can,
> but the mod_rewrite thing was something I came across recently that
> looked interesting.
>
> Both the mod_rewrite and the maybe-possible Apache config things can
> be done through .htaccess files which are sometimes available in
> shared hosting environments.
>
> DaveI think (haven't tested, though) you can use mod_alias (enabled by default in Apache 1.3) and the RedirectMatch directive: http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirectmatch I have put some examples here, similar to what you want: http://redantigua.com/redirect.html#apache Regards, Johan --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
