htaccess rewriterule 2 parameters in url

im 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?
Thanks in advance

Answer:

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]

0 Response to "htaccess rewriterule 2 parameters in url"

Đăng nhận xét

Popular Posts

Popular Posts