スラッシュの後のすべてを にリダイレクトするルールを作成しましたindex.php?section=site
。このルールは正常に機能します。
RewriteRule (.*)(\/)? index.php?section=site
uri が/cms/....
にリダイレクトする場合index.php?section=cms
。問題は、最初のルールがすべてを示してindex.php?section=site
いるため、URLの開始が cms である場合、それを回避するにはどうすればよいですか?
私はこれを試しました:
RewriteRule (.*)(\/)? index.php?section=site
RewriteRule cms\/(.*) index.php?section=cms [L]
例えば :
- 次のような URL: domain.com/login 、 index.php?section=site に属します
- 次のような URL: domain.com/cms/login 、 index.php?section=cms に属します