mod_rewrite - I know next to nothing

Discussion in 'Apache' started by TwisterMc, Feb 24, 2005.

  1. #1
    Here I go. Learning something new. I want to make a mod_rewrite. :) Basically I have a bunch of dynamic links like this...
    page.php?id=1
    page.php?id=2
    page.php?id=3

    Well Google is hating them so i wanna make a script works the same way but the urls would be...
    page/1/
    page/2/
    page/3/

    Now I know that mod_rewrite is the way to go, I just don't know much more.

    Can anyone help? Or at least point me to a good, not to technical, tutorial. I was at the apache.org site and got information overloaded.

    Thanks
     
    TwisterMc, Feb 24, 2005 IP
  2. honey

    honey Prominent Member

    Messages:
    15,555
    Likes Received:
    712
    Best Answers:
    0
    Trophy Points:
    325
    #2
    Yes, I can help. PM me.
     
    honey, Feb 24, 2005 IP
  3. flawebworks

    flawebworks Tech Services

    Messages:
    991
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    78
    #3
    Others would like the answer to this as well.
     
    flawebworks, Feb 24, 2005 IP
  4. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Here's a simple example with test-cgi, so that it's easy to see the query string:

    RewriteEngine   on
    RewriteRule ^test-cgi/([0-9]+)/?$ /cgi-bin/test-cgi?id=$1
    Code (markup):
    The part before the space is the regular expression Apache will try to match every request URL to. The regular expression above will match /test-cgi/1 and /test-cgi/1/. Everything that matches the expression inside parenthesis may be put into the resulting URL using $1, $2, etc (positionally):

    RewriteRule ^test-cgi/([0-9]+)/([0-9]+)/?$ /cgi-bin/test-cgi?v1=$1&v2=$2
    Code (markup):
    This regular expression will match /test-cgi/1/2 and /test-cgi/1/2/.

    J.D.
     
    J.D., Feb 24, 2005 IP
  5. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Humm... I'll have to give that a try. Thanks. :) If it doesn't work I'll be back with questions. To bad I won't be able to try it until next week.
     
    TwisterMc, Feb 25, 2005 IP
  6. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    TwisterMc, Mar 6, 2005 IP
  7. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Try this forum. I've found it helpful
    mod-rewrite*com/forum/
     
    kyle422, Mar 6, 2005 IP
  8. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I got it!!! Yea!!!
     
    TwisterMc, Mar 6, 2005 IP