前提・実現したいこと
下記のように、URLに余計な「/」がついた際に正規のURLへ.htaccessでリダイレクトをさせたいです。
どなたかわかるかた、お教えいただけたら幸いです。
http://example.com/hoge//fuga.html
↓
http://example.com/hoge/fuga.html
http://example.com/hogehoge.html/
↓
http://example.com/hogehoge.html
試したこと
RewriteEngine on RewriteRule ^(.*)$ http://example.com/hoge/$1 [R=301,L] RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/hoge/$1 [R=301,L]
⇒繰り返しリダイレクトが行われてしまう
RewriteEngine on RewriteRule ^(.*)/+$ $1 [R=301,L]
⇒特に変化なし
RewriteEngine on DirectorySlash Off
⇒特に変化なし

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/03 02:10