PHP和放大器;的.htaccess - 转site.com/index.php?a=6&b=3成site.com/6/3? [英] PHP & .htaccess - turn site.com/index.php?a=6&b=3 into site.com/6/3?
本文介绍了PHP和放大器;的.htaccess - 转site.com/index.php?a=6&b=3成site.com/6/3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何做到这一点?
推荐答案
试试这个 mod_rewrite的规则:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^a=(\d+)&b=(\d+)$
RewriteRule ^index\.php$ %1/%2
这将在内部重写 /index.php?a=6&b=3
的要求 / 6/3
。
This will rewrite a request of /index.php?a=6&b=3
internally to /6/3
.
如果你愿意要反过来:
RewriteEngine on
RewriteRule ^(\d+)/(\d+)$ index.php?a=$1&b=$2
这将改写 / 6/3
内部以 /index.php?a=6&b=3 $ C的请求$ C>。
这篇关于PHP和放大器;的.htaccess - 转site.com/index.php?a=6&b=3成site.com/6/3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文