Reputation: 4146
I have the following url:
http://www.domain.com/results.php?state=WA&city=Seattle&sub=algebra
I would like it to appear as:
http://www.domain.com/results/WA/Seattle/algebra
And...
http://www.domain.com/results.php?state=WA&city=Seattle
as
http://www.domain.com/results/WA/Seattle
I figure I could write the first as:
RewriteRule ^results/(.*)/(.*)/(.*)$ /results.php?state=$1&city=$2&sub=$3 [L]
but I'm stuck figuring out how to combine both of them... the slashes are throwing me. Any suggestions?
Upvotes: 0
Views: 319
Reputation: 2290
RewriteRule ^results/([^/]+)/([^/]+)/([^/]+)$ /results.php?state=$1&city=$2&sub=$3 [L]
RewriteRule ^results/([^/]+)/([^/]+)$ /results.php?state=$1&city=$2
Upvotes: 1