I have one problem. I want to do below redirect. How can i do this? www.abc.com/states/florida => www.abc.com/states.php?states=florida www.abc.com/city/new-york => www.abc.com/cities.php?city=new-york Please help me. Thank you.
RewriteEngine on RewriteRule state/(.*) ./states.php?state=$1 [PT] RewriteRule city/(.*) ./cities.php?city=$1 [PT] Code (markup):
Now, I want one more solution. www.abc.com/states/florida => www.abc.com/states.php?states=florida www.abc.com/states/florida/colleges/engineering => www.abc.com/states.php?states=florida&colleges=engineering How, can i do this? I gave RewriteRule states/(.*)/colleges/(.*) ./states.php?state=$1&colleges=$2 [PT] Code (markup): then it's working fine for second one but not first one. I want it to work for both. Please help me.
this code should work for the 3 redirects you want: www.abc.com/states/florida => www.abc.com/states.php?states=florida www.abc.com/city/new-york => www.abc.com/cities.php?city=new-york www.abc.com/states/florida/colleges/engineering => www.abc.com/states.php?states=florida&colleges=engineering RewriteEngine on RewriteRule states/(.*)/colleges/(.*) ./states.php?states=$1&colleges=$2 [PT] RewriteRule states/(.*) ./states.php?states=$1 [PT] RewriteRule city/(.*) ./cities.php?city=$1 [PT] Code (markup):