开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜