Skip to main content
All CollectionscPanel
How to redirect traffic from HTTP to HTTPS?
How to redirect traffic from HTTP to HTTPS?
Ieva avatar
Written by Ieva
Updated over a week ago

After you have purchased an SSL certificate, you need to perform important changes on your website. Please follow these steps.

In order to redirect all request to your website through encrypted connection you have to edit/create “.htaccess” file in your “public_html” folder and paste this code:

RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

In order to redirect only specific part of the website use this code:

RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule secure.html https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Where “secure.html” is a part of your website which will be displayed through HTTPS protocol. If you would like to add more files use “|” operator, for example “secure.html|secure2.html|secure.php”

Did this answer your question?