SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot Fed's Avatar
    Join Date
    Jun 2005
    Location
    Italy
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess weird problem

    here's my simple .htaccess file
    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/?([a-zA-Z-_]+)/([a-zA-Z-_]+)/([0-9a-zA-Z-_]+)/?$ view.php?state=$1&city=$2&discussion=$3 [L]
    RewriteRule ^/?([a-zA-Z-_]+)/([a-zA-Z-_]+)/?$ discussions.php?state=$1&city=$2 [L]
    RewriteRule ^/?([a-zA-Z-_]+)/?$ bystate.php?state=$1 [L]
    it works in windows (XAMPP environment) but gives a 500 error on the server (linux hostgator shared server with other sites using mod_rewrite with no problems at all)

    any idea? do you see somethin wrong? I tried with a different editor, different encoding...everything...
    I | T | E

  2. #2
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What was the error? Check your Apache logs.

  3. #3
    SitePoint Zealot Fed's Avatar
    Join Date
    Jun 2005
    Location
    Italy
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RewriteRule: cannot compile regular expression '^/?([a-zA-Z-_]+)/([a-zA-Z-_]+)/([0-9a-zA-Z-_]+)/?$'\n

    the same if I remove that line, but with the following one

    might it be that trailing "\n"?
    I tried to write the htaccess with another editor, another encoding, another transfer type....I've been on this HOURS and I can't get it to work...
    I | T | E

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Fed,

    Kudos to the maniac for making you show the error!

    When you use a metacharacter within a range definition, it must be used correctly. Your use of the hyphen (dash) after the Z implies the start of a new range (from Z to _) which is not possible. I've repeatedly said that sources require the hyphen to be the first character but some allow it as the last character - it works - so it is not mistaken as part of a range definition.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •