Help with mode rewrite for 2 dynamic urls

Discussion in 'Apache' started by youngpatriot, Aug 8, 2006.

  1. #1
    Hi, I've been puzzling over this all morning, can anyone give me a hand?

    I've got 2 dynamic urls that need to display static:

    www.mydomain.com/listings.php?state=DE&city=Bear needs to show www.mydomain.com/DE/Bear.php

    and

    www.mydomain.com/selectcity.php?state=DE needs to show www.mydomain.com/DE/selectcity.php

    Thanks a bunch, my head is about to explode!

    David
     
    youngpatriot, Aug 8, 2006 IP
  2. youngpatriot

    youngpatriot Peon

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Of course I meant mod_rewrite in the subject, sorry.
     
    youngpatriot, Aug 8, 2006 IP
  3. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here's a simple solution to your problem:

    
    RewriteRule (.*)/$ selectcity.php?state=$1
    RewriteRule (.*)/(.*).php$ listings.php?state=$1&city=$2
    
    Code (markup):
    Hope it helps,

    Cryo.
     
    Cryogenius, Aug 9, 2006 IP
  4. neerajkhichi

    neerajkhichi Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    [QUOTE Neeraj Khichi]Hi, I've been puzzling over this all morning, can anyone give me a hand?:eek:

    I've got 2 dynamic urls that need to display static:

    http://www.mydomain.com/?page=home needs to show http://www.mydomain.com/

    and

    http://www.mydomain.com/?page=sys needs to show http://www.mydomain.com/sys.html

    Thanks a bunch, my head is about to explode!

    Neeraj Khichi[/QUOTE]

    Plz. Let me Know About it as soon as.
     
    neerajkhichi, Aug 31, 2006 IP