Humbly seeking pardon for asking a question which might be perceived as offtopic to some.

This aspiring perl-guru needs to redirect requests for certain directories (with the exception of some subtrees) to a different webserver. Examples will make this clear.

Requests to http://server1/basedirectory should go to http://server2/basedirectory

Likewise we need the following:
http://server1/basedirectory/something -> http://server2/basedirectory/something
etc.

However we need to omit some urls from the rule: http://server1/basedirectory/exceptiondirectory1 and http://server1/basedirectory/exceptiondirectory2 (and their subtrees) should stay on the same server and not get redirected.

We have apache 1.3.26 compiled with both mod_alias and mod_rewrite, and we are currently using a very ugly solution to this problem, the following rule:
RedirectMatch ^/basedirectory/([^e])(.*)$ http://server2/basedirectory +/$1$2

This will will match our exception directories and then some extra unwanted stuff too.

What I really want is something like what perl supports. Is there a way to do something like the following:
RedirectMatch ^/basedirectory/(?!exceptiondirectory1|exceptiondirector +y2)(.*)$ http://server2/basedirectory/$1$2

Thanks in advance to any who can advise me,

Rohit

In reply to apache RedirectMatch (regexp question) by Cmdr_Tofu

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.