Ok here's the problem. after installing mod_perl I placed the script I wanted to run into the perl directory called it and all worked swimmingly.

The script is called by lots of clients on different web servers So I cannot easily change the location of the script to /perl/

An easy fix or so I thought was to rewrite the url using mod rewrite so that the server would look for the script in the correct directory (/perl/) rather than the requested directory (/cgi-bin/)

I inserted this into httpd.conf in the virtual server configuration
<code>#redirect mlserver requests to the faster mod_perl
RewriteEngine on
RewriteRule ^/cgi-bin/mlserver.pl(.*) /perl/mlserver.pl$1</code>

Bonza it worked

But then I realised it was still running under CGI not mod_perl!

Now I cannot find a way to get the script running under mod_perl. CGI always takes over!
If I remove the shebang line the script fails
If I call it directly ie: server.com/perl/mlserver.pl it works correctly under mod_perl

How can I redirect an incoming request to the new mod_perl script?

I know this question is probably more an apache one, but I hope someone here can assist

I have tried renaming the script to mlserver.perl and the setting a new handler

ie: AddHandler perl-script .perl

but all that does is send back plain text, it doesn't execute mod_perl at all

Any ideas apart from telling all my clients to change the code on hundreds of sites?


In reply to Seems simple enough how do I redirect old cgi scripts to mod perl? by ManagedLinks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.