I’ve list of states and a php file which will list all the city of the state. By taking the URL parameter as /common.php/?state=Texas and list all the cities.
After clicking on the city it takes the url as /common.php/?city=Alanreed&state_code=TX and displays the city information.
I want to format the url using .htaccess like for states it should take state_name.html eg. Texas.html and for city name either Texas/sugar_land.html or tx/sugar_land.html How can I achieve this using php and .htaccess?
\w{2}means 2 word characters, so it is rewritten as a state code, the second rule is to rewrite the full state names and the third is to rewrite states.