0

次のURLを変換したい:

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

の中へ:

http://localhost/index/bar/foo

つまり、ページ拡張子をスラッシュに置き換えてから、1 つ以上の変数を再帰的に書き換えたいと考えています。

これは可能ですか?

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 に答える