私のhtaccessは次のようになります。
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.site.com$ [NC]
RewriteRule .? http://site.com%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} /page1/([^?].*)$ [NC]
RewriteRule /page1/(.*)$ /page1/?$1 [L] # change /page1/stuff to /page1/?stuff
# End rewriting for page1
RewriteCond %{REQUEST_URI} /page2/([^?].*)$ [NC]
RewriteRule /page2/(.*)$ /page2/?$1
# End rewriting for page2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://%{HTTP_HOST}/$1 [R=301,NS,L]
Options -Indexes
また、ユーザーがsite.com/page1/stuff
orsite.com/page1/stuff/more
に移動した場合、アドレスバーに末尾のスラッシュを追加して and に変更することsite.com/page1/stuff/
も望んでいますがsite.com/page1/stuff/more/
、私が試したものは何も機能しません。リダイレクトループを引き起こさずにこれを行う方法はありますか?
すべての URL の末尾にスラッシュを付けたいのですが、ディレクトリが既にそうしています。
編集:明確にするために、末尾のスラッシュをユーザーに表示したいが、?