PHP & .htaccess - turn example.com/index.php?a=6&b=3 into example.com/6/3?
How would I do thi开发者_JAVA百科s URL change?
Try this mod_rewrite rule:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^a=(\d+)&b=(\d+)$
RewriteRule ^index\.php$ %1/%2
This will rewrite a request of /index.php?a=6&b=3
internally to /6/3
.
And if you rather want the other way round:
RewriteEngine on
RewriteRule ^(\d+)/(\d+)$ index.php?a=$1&b=$2
This will rewrite a request of /6/3
internally to /index.php?a=6&b=3
.
精彩评论