Hi :-)

Is there a way to send request to external perl script by adding some mod_rewrite condition and then, depending on script response, apply some rewrite rule?

I need something like this:

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond IF SCRIPT /home/cgi-bin/ckw.cgi\?%{REQUEST_URI} RETURNS 1 RewriteRule ^.*$ (rewrite rule goes here) [L] </IfModule>
Why do I need that? I have a MySQL database with keywords. When visitor clicks some link on my website, RewriteCond condition sends request to that ckw.cgi script with %{REQUEST_URI} as a query string. Script parses the request URI, search for keywords used in REQUEST_URI through database and returns 1 or 0. If it returns 1 - RewriteRule is applied for this link, elsif it returns 0 - no rules applied.

Is there a way to do this? My English is not perfect but I hope you understand me.

Thanks, Lana


In reply to Getting response from external script by Apache mod_rewrite condition by Lana

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.