Quick RewriteCond help

Discussion in 'Apache' started by decepti0n, Feb 2, 2008.

  1. #1
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^(forum|images) [NC]
    RewriteRule ^(.*)$ core.php
    Code (markup):
    I want to redirect everything to core.php, unless it is in a few different directories (in this case forum/ or images/), but that doesn't seem to work

    In other words,

    /f/f/f -> core.php
    /foru2m/index -> core.php
    /forum/index.php -> stays normal
    /images/image.png -> stays normal

    Thanks for any help
     
    decepti0n, Feb 2, 2008 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    I believe REQUEST_URI will begin with a forward slash.
     
    joebert, Feb 3, 2008 IP
  3. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It does, and I tried adding the slash but that didn't work either
     
    decepti0n, Feb 4, 2008 IP
  4. Cybernaut

    Cybernaut Peon

    Messages:
    408
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Don't create a loop. Rewrite process keeps repeating itself until no RewriteCond matches or process is stopped explicitly by L flag.

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/(forum|images) [NC]
    RewriteRule ^(.*)$ /core.php [[color=red]L[/color]]
    Code (markup):
     
    Cybernaut, Feb 9, 2008 IP