Mod Rewrite Rules / .htaccess

Discussion in 'Apache' started by KatieK, Jan 19, 2008.

  1. #1
    I must be missing something obvious, but I can't figure out why this isn't working:

    This is my complete .htaccess file.
    RewriteEngine On
    RewriteRule ^tags/([A-Za-z0-9]+)/?$ tags.php?tag=$1
    RewriteRule ^tag/([A-Za-z0-9]+)/?$ tags.php?tag=$1
    RewriteRule ^blogs/([A-Z0-9]+)/?$ archive.php?lid=$1

    The 3rd and 4th lines work. A visitor to domain.com/tag/reviews will be shown the correct content generated by tags.php. But a visitor to domain.com/tags/reviews will be shown only "No input file specified." which comes from Apache, I think.

    (This is on an Apache server running PHP, of course.)

    Can any one explain why the 2nd line doesn't work? Thanks in advance!
     
    KatieK, Jan 19, 2008 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    Looks like a typo.

     
    SoKickIt, Jan 20, 2008 IP
  3. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #3

    Both the 2nd and 3rd line are supposed to go tags.php - the same file. I added the 3rd line to try to figure out why the 2nd line wasn't working.
     
    KatieK, Jan 20, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Have you tried flipping the order of the rules, to see if it makes any difference?

    Jay
     
    jayshah, Jan 20, 2008 IP
  5. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Alas, swapping lines 2 and 3 makes no difference.
     
    KatieK, Jan 20, 2008 IP
  6. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #6
    Have you checked your error logs to see if anything shows there? Apache may have logged a more specific error.

    Also, this Google search:

    google.co.uk/search?hl=en&safe=off&q=mod_rewrite+%22no+input+file+specified%22&btnG=Search&meta=

    (I can't post live links yet, sorry about that)

    May help you.

    Jay
     
    jayshah, Jan 21, 2008 IP
  7. gpearce

    gpearce Active Member

    Messages:
    1,432
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    90
    #7
    Try removing the ? before the $ at teh end of the match string, i've never seen them before, but i think ? affects the Mod_Rewrite engine. If it needs to be there, try placing a \ before it.
    -g
     
    gpearce, Jan 21, 2008 IP