R
R
Rickern2022-01-27 17:58:14
htaccess
Rickern, 2022-01-27 17:58:14

What does a redirect look like with "http:// www." to "https://"?

Did not help:

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]


It is necessary that the redirect be in one step, i.e. immediately with "http:// www." to "https://", bypassing "http://" or " https://www ."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2022-01-27
@werwolflg

This should help

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question