-2

I'm use a rewrite rule and map:

mydomain.com/miami-fl-33308/

to

mydomain.com/city.php?ci=miami&st=fl&zi=33308
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
kelsheikh
  • 1,278
  • 3
  • 17
  • 37

1 Answers1

0

Simply use

RewriteRule ^(\w+)-(\w+)-(\d+)/? /city.php?ci=$1&st=$2&zi=$3 [L]
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • Ah Perfect, thank you. I should have have also asked about what I should do if I have a city with a dash in it. Is there a way to handle a dash in the city variable if there is one? [code]mydomain.com/saint-petersberg-fl-33308/ to mydomain.com/city.php?ci=miami&st=fl&zi=33308 – kelsheikh May 08 '13 at 23:21
  • @user2360410 Change `(\w+)-(\d+)` to `([\w-]+)-(\d+)` – hjpotter92 May 08 '13 at 23:44
  • @user2360410 You can select this reply if it helped. The question still appears under unanswered list. – hjpotter92 Sep 24 '15 at 04:34