Reputation: 123
I am having an issue with rewriting an url via .htaccess
,
I have the following url
www.website.com/people.php?search=search
via htaccess
I turn it into .../people/search
RewriteRule ^people/([a-zA-Z0-9]+)$ people.php?search=$1
RewriteRule ^people/([a-zA-Z0-9]+)/$ people.php?search=$1search=$1
in the url the user can also add a location which should be
www.website.com/people.php?search=something&&location=something
How can I use rewrite rule to add the two search parameters to the new rewrite url?
Upvotes: 3
Views: 1009
Reputation: 41219
This should be your 2nd rule
RewriteRule ^people/([^/]+)/([^/]+)/?$ people.php?search=$1&location=$2 [NC,QSA,L]
It rewrites "/people/foo/bar" to "/people.php?search=foo&location=bar"
Try :
RewriteRule ^people/([^/]+)/([^/]+)/?$ people.php?search=$1&location=$2 [NC,QSA,L]
RewriteRule ^people/([a-zA-Z0-9]+)$ people.php?search=$1 [NC,QSA,L]
Upvotes: 2