url rewriting beginner's tutorial

Discussion in 'PHP' started by master-mind, Aug 22, 2008.

  1. #1
    Hi,

    I have good expertise with php but new to url rewriting. I need some help creating some static urls for database driven US states' pages.

    what I need to do is...
    alabama.html should be dealers.php?state=alabama
    likewise
    new-jersey.html should be dealers.php?state=new jersey

    Any help would be highly appreciated.

    Thanks
     
    master-mind, Aug 22, 2008 IP
  2. cgo85

    cgo85 Peon

    Messages:
    380
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    cgo85, Aug 22, 2008 IP
  3. lfhost

    lfhost Peon

    Messages:
    232
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    RewriteEngine on
    Options +FollowSymLinks
    
    RewriteRule ^(.*)\.html$ dealers.php?state=$1
    
    PHP:
    You cant really do new-jersey.html unless the state is new-jersey
     
    lfhost, Aug 22, 2008 IP