D
D
Dmitry Goloshchapov2021-07-14 09:51:54
htaccess
Dmitry Goloshchapov, 2021-07-14 09:51:54

How to make a redirect with multiple slashes /// immediately to https?

The essence of the problem is that if you go to a link like https://domen.ru/page////// the following chain of consecutive redirects occurs : https://domen.ru/page//////
= > http : // domen.ru/page/ => https :// domen.ru/page/ It is necessary that a 301 redirect like https :// domen.ru/page////// => https :/ /domen.ru/page/ There are two rules in my htaccess, how to properly group/combine them, and is there such a possibility at all? RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI } [L,R=301]

RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-07-14
@Trilogo

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}/$0 [L,R=301]

RewriteCond %{THE_REQUEST} //
RewriteRule .* https://%{HTTP_HOST}/$0 [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question