Regex Can';t在没有尾部斜杠的情况下重定向到url
这是我的Regex Can';t在没有尾部斜杠的情况下重定向到url,regex,.htaccess,Regex,.htaccess,这是我的.htaccess Options -Indexes ServerSignature Off RewriteEngine On RewriteBase / # Redirect to index.php RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_METHOD} !HEAD RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Rewr
.htaccess
Options -Indexes
ServerSignature Off
RewriteEngine On
RewriteBase /
# Redirect to index.php
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_METHOD} !HEAD
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Enable compression
<FilesMatch "\.(html?|txt|css|js|php|pl)$">
SetOutputFilter DEFLATE
</FilesMatch>
# Caching control
<IfModule mod_headers.c>
Header set Cache-Control "max-age=86400"
Header set Pragma "max-age=86400"
Header set Expires 0
</IfModule>
# Redirect to https
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# Redirect from www.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*) https://%1/$1 [L,R=301]
及
及
及
但是没有一个有效好的,这一个有效:
RedirectMatch ^(.+)/$ $1
RewriteCond %{REQUEST_URI} ^([^.]+)/$
RewriteRule ^[^.]+/$ /%1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) https://example.com/$1/ [R=301,L]
RewriteCond %{QUERY_STRING} ^(.+)/$
RewriteRule ^ %{REQUEST_URI}?%1 [L,R=301,NE]
RedirectMatch ^(.+)/$ $1