# на https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# c www на без www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# без многократных слешей
RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]
# в нижнем регистре
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
1. Редирект на https;
2. Редирект на без www + без повторяющихся слешей;
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
[OR]
RewriteCond %{HTTPS};%{HTTP_HOST};%{THE_REQUEST} !^on;(?!www\.)[^;]+;(?!.*//) [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST};%{HTTPS};%{THE_REQUEST} ^(?=(?:www\.|)([^;]+))(?!(?!www\.)[^;]+;on;(?!.*//)) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} //
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{THE_REQUEST} //
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} //
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{THE_REQUEST} //
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} //
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
cond1 [OR]
cond2 [OR]
cond3 [NC]
cond4 [NC]
if ( (cond1 OR cond2 OR cond3) AND cond4 ) {
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
[OR]
RewriteCond %{HTTPS};%{HTTP_HOST};%{THE_REQUEST} !^on;(?!www\.)[^;]+;(?!.*//) [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
^on;(?!www\.)[^;]+;(?!.*//)
совпадёт только когда в %{HTTPS} будет "on" и %{HTTP_HOST} без www и %{THE_REQUEST} без повторяющихся слешей.FileName.jpg
и filename.jpg
это разные файлы./images/FileName.jpg
, то после редиректа с переводом в нижний регистр /images/filename.jpg
файл не будет найден и в итоге ошибка 404. # в нижнем регистре
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
RewriteCond %{THE_REQUEST} ^\S+\s[^?\s]+(//|[A-Z]) [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/${lc:$1} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[A-Z].*)$ https://site.ru/${lc:$1} [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*[A-Z].*)$ https://site.ru/${lc:$1} [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
[^.]*
применить вместо RewriteCond %{REQUEST_URI} !\.
RewriteRule ^([^.]*[A-Z][^.]*)$ https://site.ru/${lc:$1} [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*/[^/\.]+)$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^([^.]+)[^/.]$ https://%1/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{ENV:HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
${lc:$1}
будет работать только если в httpd.conf или прямо в <VirtualHost>
стоит RewriteMap lс int:tolower
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^([^.]+)[^/.]$ https://%1/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteRule ^(.*/[^/\.]+)$ https://%1/$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[A-Z].*)$ https://%1/${lc:$1} [R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*/[^/\.]+)$ https://%1/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
#RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
он выдает 443 порт
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.+) [NC]
нужно в регулярке поменять (.+)
на ([^:]+)
чтобы отсекать :443
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^(?:www\.|)([^:]+) [NC]
RewriteRule ^(.*[A-Z].*)$ https://%1/${lc:$1} [R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.|)([^:]+) [NC]
RewriteRule ^([^.]+[^/.])$ https://%1/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)([^:]+) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Если /catalog/hood/standard является существующей папкой, то тут вмешивается mod_dir, который автоматически добавляет в конце адреса "/" для существующих папок.
Правилами mod_rewrite это не исправить.
${lc:$1}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[A-Z].*)$ https://%{HTTP_HOST}/${lc:$1} [R=301,L]
RewriteRule ^([^.]+[^/.])$ https://%{HTTP_HOST}/$1/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond $0 [A-Z] [OR]
RewriteCond $0 [^/]$
RewriteRule ^([^.]+?)/?$ https://%{HTTP_HOST}/${lc:$1}/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^([^.]+?)/?$ - [E=URI:$1]
RewriteCond $0 [A-Z] [OR]
RewriteCond $0 [^/]$
RewriteCond expr "tolower(reqenv('URI')) =~ /(.+)/"
RewriteRule ^([^.]+?)/?$ https://%{HTTP_HOST}/%1/ [R=301,L]
RewriteCond %{THE_REQUEST} // [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]