in reply to Seems simple enough how do I redirect old cgi scripts to mod perl?

Change the rewrite rule to do an explicit redirect, with something like the following?

#redirect mlserver requests to the faster mod_perl RewriteEngine on RewriteRule ^/cgi-bin/mlserver.pl(.*) /perl/mlserver.pl$1 [R]
Steve
--
  • Comment on Re: Seems simple enough how do I redirect old cgi scripts to mod perl?
  • Download Code

Replies are listed 'Best First'.
Re^2: Seems simple enough how do I redirect old cgi scripts to mod perl?
by jhourcle (Prior) on Sep 30, 2005 at 16:47 UTC

    A word of warning -- it's a good idea when using R to use R,L, so it then doesn't try to do further processing on this request.

    Now for the problem -- R can cause havoc with some browsers if they're trying to POST (which is very likely for a CGI). It would be good to read section 10.3 in the HTTP specs, and some of the POSTredirect test results.

    Basic summary -- you would think you want 301 (moved permanently), but it screws up browsers; you'll want to use 303 for an HTTP/1.1 browser, and 302 for an HTTP/1.0 browser. (0.9 browsers don't support redirection in HTTP, as they don't pass any headers), and you'll want to test heavily.

    As another alternative, you can just configure the system to serve that particular URL as mod_perl, as opposed to CGI, without any need for redirection:

    <Location /cgi-bin/mlserver.pl> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI allow from all PerlSendHeader On </Location>