问题
If i wanted to simply redirect /clients/page/
to /clients.php?view=page
i would use something as simple as this, it works great.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^clients/([^/]+) /clients.php?section=$1&$2 [NC]
If i had for example, a url like: /clients/page/?name=Tom
how could i transfer those HTTP GET variables to a simple url like /clients.php?view=page&name=Tom
i have tried and failed.
Any ideas?
回答1:
I think you can use the [QSA] flag, which stands for Query String Append. This means that you can add variables to the Query String easily:
RewriteRule ^clients/([^/]+) /clients.php?section=$1 [QSA, NC]
回答2:
I think you're looking for the [QSA] flag on the RewriteRule:
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#RewriteRule
That should cause mod_rewrite to preserve your original query parameters.
RewriteRule ^clients/([^/]+) /clients.php?section=$1 [QSA,NC]
来源:https://stackoverflow.com/questions/2088804/htaccess-confusing-clean-urls