rewrite rule conflict

Discussion in 'Apache' started by varunkrish, Dec 14, 2005.

  1. #1
    Options -Indexes
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wallpapers\-(.*)\-index\.html$ wallpapers.php?category=$1 [nc]

    RewriteRule ^wallpapers\-(.*)\-(.*)\-index\.html$ wallpapers.php?category=$1&folder=$2 [nc]

    there is a conflict between rules 1 and 2 . i cant figure it out

    please help.

    if i remove rule1 rule2 works fine or else rule1 catches both rule1 and rule2 :(
     
    varunkrish, Dec 14, 2005 IP
  2. varunkrish

    varunkrish Peon

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule ^wallpapers\-([0-9x]*)\-index\.html$ wallpapers.php?category=$1 [nc]

    i put second rule as this at itworks like charm

    is it correct?
     
    varunkrish, Dec 14, 2005 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Change the order of them. Bigger lines go first. Bigger as in more $# stuff.

    List the line with the most variables first, then the second most and so on.
     
    Nintendo, Dec 14, 2005 IP
  4. varunkrish

    varunkrish Peon

    Messages:
    107
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    great !!! it works
     
    varunkrish, Dec 14, 2005 IP