C
C
cavva2019-05-25 16:33:39
htaccess
cavva, 2019-05-25 16:33:39

How to set redirect to https in .htaccess?

Good afternoon. I'm trying to redirect a site from:
site.com
www.site.com
http
to https://site.com

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.site.com $ [NC]
RewriteCond %{HTTP_HOST} ^site.com
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://site.com/$1 [R=301,L]

Please write the correct version. Thank you in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Laziness of the Romanovs, 2019-05-25
@1bragimov

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question