Buying Htaccess Mod Help - $5

Discussion in 'Programming' started by mcmuney, Aug 3, 2011.

  1. #1
    I need to perform these two changes using .htaccess:

    1)
    I'm currently using urls like this: domain.com/state.php?state=CA (the CA is being used to pull other information from the DB)
    What I'd like to do is show the url as: domain.com/California

    2)
    I'm currently using urls like this: domain.com/state2.php?city=Los Angeles&state=CA (the CA and Los Angeles are being used to pull other information from the DB)
    What I'd like to do is show the url as: domain.com/California/Los Angeles

    Note: Currently using $_GET to retrieve city and state from the URL and this function needs to remain in tact. Not sure if this is doable. I need this to be automated as there are too many city/state combinations.
     
    mcmuney, Aug 3, 2011 IP
  2. Scoding

    Scoding Well-Known Member

    Messages:
    1,091
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    155
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Have in mind that if you do this in htaccess, any requested url will be considered as a state, i'd suggest do /state/<name>

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /


    RewriteRule ^state/([^/]+) state.php?state=$1 [QSA]
     
    Scoding, Aug 3, 2011 IP
  3. mcmuney

    mcmuney Well-Known Member

    Messages:
    834
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    128
    As Seller:
    100% - 0
    As Buyer:
    100% - 3
    #3
    Thanks, but I've found a solution.
     
    mcmuney, Aug 3, 2011 IP