So I have a webpage that queries some data based on this parameter search.php?state=AL
.
What I'm trying to do is write a rule in my .htaccess
file that will:
- translate
website.com/state/AL
intosearch.php?state=AL
- If a user specifically request
search.php?state=AL
then translate that into/state/AL
I accomplished step 1 using this:
RewriteRule ^state/([A-Za-z][A-Za-z]) /search.php?state=$1 [NC]
How can I accomplish step 2? I know I will have to use [R, NC]
to actually rewrite the URL, but thats where I'm stuck.
EDIT: Not sure if this matters but my webhost forces me form some reason to add RewriteBase /
to the top of my .htaccess
file.