0

我想转换以下网址:

http://localhost/index.php?foo=bar&bar=foo

进入:

http://localhost/index/bar/foo

换句话说,我想用正斜杠替换页面扩展名,然后递归地重写一个或多个变量。

这可能吗?

4

1 回答 1

0
# to redirect the browser to friendly
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?foo=([^&]+)&bar=([^&\ ]+)
RewriteRule ^ /index/%1/%2? [L,R=301]

# to internally rewrite friendly back to the proper resource
RewriteRule ^/?index/([^/]+)/([^/]+)$ /index.php?foo=$1&bar=$2 [L,QSA]
于 2012-09-21T16:05:14.417 回答