RewriteRule Regexp assistance

Discussion in 'Linux & BSD' started by LordOfLA, Apr 24, 2008.

  1. LordOfLA

    LordOfLA Godlike!

    Messages:
    7,027
    Location:
    Maidenhead, Berkshire, UK
    I got an apache rewrite rule as follows in a .htaccess file:

    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    This came with drupal 6.2

    Problem is this stops my invision forum working properly and totally prevents access to the admin side of things.

    I need to change said rule to say basically:

    "if the url matches /forum/* don't do anything, for everything else run the rule."

    I've tried RewriteCond %{REQUEST_FILENAME} !^/forum/*

    However that doesn't seem to work all the time. Any ideas?
     
  2. JPRuss

    JPRuss OSNN Addict Folding Team

    Messages:
    77
    Location:
    In the unknown
    Perhaps try putting a second rewrite rule at the top of the htaccess file

    RewriteRule ^/forums/(.*) /forums/$1 [L,QSA]
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    So if thie url contains /forums/ in it it should redirect to the /forms/ directory and stop processing.

    I didn't get a chance to try this first, but that's the general idea
     
  3. JPRuss

    JPRuss OSNN Addict Folding Team

    Messages:
    77
    Location:
    In the unknown
    Any luck?