多くのパラメーターを使用してサイトを構築しています。現時点では、.htaccess ファイルでこのコードを使用しています。
Options +FollowSymLinks
RewriteEngine on
RewriteBase /epo
RewriteRule (.*)/(.*)/(.*)/(.*)/(.*)/$ index.php?section=$1&content=$2&site=$3¶m=$4¶m2=$5 [QSA]
RewriteRule (.*)/(.*)/(.*)/(.*)/$ index.php?section=$1&content=$2&site=$3&subsite=$4 [QSA]
RewriteRule (.*)/(.*)/(.*)/$ index.php?section=$1&content=$2&site=$3 [QSA]
RewriteRule (.*)/(.*)/$ index.php?section=$1&content=$2 [QSA]
RewriteRule (.*)/$ index.php?section=$1 [QSA]
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI}/ [R=301,L]
私は mod_rewrite が初めてなので、このコードがめちゃくちゃです。これらすべてのパラメータを処理するより良い方法はありますか? 最後の 2 行は、末尾に "/" がない場合に追加するためのものです。誰かが自分のコードを説明してくれれば、私が何を間違えたのか理解できるでしょう:)