mod_rewrite : difference between windows and linux?

Discussion in 'Apache' started by Ron, Feb 20, 2006.

  1. #1
    Does mod_rewrite work exactly the same on linux and on windows?
    I have the a rewrite rule, that works perfectly on my local win XP system but won't work when I upload it to my provider (linux machine)
    I have other rewrite rules running fine locally and on my providers machine

    I want to change www.mydomain.com/Name__id__545.php to www.mydomain.com/index.php?id=545

    here's the rule:

    RewriteEngine on
    RewriteRule ^[^\/]*_id_(\d*)\.php$ index.php?id=$1 [L]

    I tried this to:

    RewriteRule ^.*_id_(\d*)\.php$ index.php?id=$1 [L]

    same thing, it works on xp but not on linux.
    any idea?
     
    Ron, Feb 20, 2006 IP
  2. UptimeAgent

    UptimeAgent Peon

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi.

    Exactly what do you see when trying to access the mentioned URL (which needs to be rewrited) at your linux machine?
     
    UptimeAgent, Feb 20, 2006 IP
  3. Ron

    Ron Peon

    Messages:
    142
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's what I get:

    Not Found
    The requested URL /Firefox1.5.0.1_id_3421.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
     
    Ron, Feb 21, 2006 IP
  4. Ron

    Ron Peon

    Messages:
    142
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Got it!!

    The problem is not the os, it's the apache version.
    On my local machine I got apache 2.0, my provider has 1.3.26.

    Apache 1.3.x doesn't support Perl compatible regular expressions (i.e. \d)

    I changed the RewirteRule to

    RewriteEngine on
    RewriteRule ^[^/_]+_id_([0-9]+)\.php$ /index.php?id=$1 [L]

    and now everything works fine
     
    Ron, Mar 3, 2006 IP