.htaccess 如果url末尾出现多个斜杠,则htaccess重定向

.htaccess 如果url末尾出现多个斜杠,则htaccess重定向,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,由于SEO要求,我必须捕获所有这些类型的请求: 1 - http://example.com 2 - http://example.com//// 3 - http://example.com////about 4 - http://example.com////about//// 5 - http://example.com////about////info 6 - http://example.com////about////info//// 并使用301重定向将用户转发到 1 - htt

由于SEO要求,我必须捕获所有这些类型的请求:

1 - http://example.com
2 - http://example.com////
3 - http://example.com////about
4 - http://example.com////about////
5 - http://example.com////about////info
6 - http://example.com////about////info////
并使用301重定向将用户转发到

1 - http://example.com/
2 - http://example.com/
3 - http://example.com/about/
4 - http://example.com/about/
5 - http://example.com/about/info/
6 - http://example.com/about/info/
对于我使用的第一个案例

RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]
但不能理解如何为其他情况编写规则

尝试以下规则:

# Remove multiple slashes anywhere in URL
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteEngine on
RewriteBase /

# add trailing slash if missing
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=302,NC,NE]

# remove multiple slashes
RewriteCond %{THE_REQUEST} \s/+(.*?)//(.*?)\s [NC]
RewriteRule ^ %1/%2 [L,R=302,NC,NE]

但是为什么你会得到这样的URL?是否有任何CMS失控?
///about/info
与此保持不变