Answer the question
In order to leave comments, you need to log in
How to set up a redirect from http to https?
Hello, I made a redirect to https, inserted the code into the .htaccess file
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Answer the question
In order to leave comments, you need to log in
IfModule mod_rewrite.c can be omitted as it is enabled by default.
just do not forget that it should be up to the cnc site, give me the whole file.
on some servers the redirect is caught differently,
somewhere
RewriteCond %{HTTPS} off works
somewhere
RewriteCond %{HTTPS} !on
in general, just pick a redirect that suits your server.
There are 30 of them
. There are also on Habré.
Here is an example
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question