问题
I want to make a rewrite module in htaccess file something like below
http://example.com/index.php?tel=604-567-0909&cat=1&sort=2
to
http://example.com/604-567-0909/?cat=1&sort=2
so $_GET
will be
$_GET[tel] = 604-567-0909
$_GET[cat] = 1
$_GET[sort] = 2
How would this rule look like?
回答1:
It would look like this if you only wanted to accept numbers and dashes in the tel
field:
RewriteRule ^/?([0-9\-]+)/$ index.php?tel=$1 [L]
The other values in the query string would be carried over automatically, and this rule would work without them just fine.
来源:https://stackoverflow.com/questions/14419658/url-rewrite-module-questions