How to redirect HTTP to HTTPS Using .htaccess | Load site Securely

How to redirect HTTP to HTTPS Using .htaccess

An SSL Certificate also is known as a secure socket layer certificate, and it offers security encryption for the websites. HTTP to HTTPS redirect .htaccess code, then you have to configure it in the .htaccess Redirect Domain.

YouStable offers cPanel to the users so they can enjoy the popular dashboard in the market today. Forcing the site to HTTP to HTTPS redirect is easy with cPanel. You need to have access to the cPanel login details that you can find in the registered email because we have sent you a copy of the details after the purchase.

Redirect HTTP to HTTPS Using .htaccess in cPanel

You can always revert the changes by following the steps backwards.

Step 1: Login to the control panel account by adding cPanel at the end of the domain, and it should look like this “” in the clipboard.

http to https redirect

Step 2: Type “file manager” in the search bar, and click on the first result.

http to https redirect

Step 3: cPanel hides important files and unnecessary files in the file manager, but you can view them. Click on the settings located at the top right menu, and a small window pop-up on your screen, then click on “show hidden files.”

http to https redirect

Step 4: Now, go to “public_html” by double-clicking on it.

http to https redirect

Step 5: You can locate the “.htaccess” file in the “public_html” and click on edit.

http to https redirect

Step 6: A small confirmation window pop-up on your screen, and then click on “edit.”

http to https redirect

Step 7: Now, you have to search for existing code by CTRL + S and type “RewriteEngine On.” If you already have the codes pasted in the file, then make sure to check if the RewriteCond and RewriteRule followed in the next lines.

http to https redirect

If the codes are not present, then you can try the below codes and copy & paste them in the “.htaccess.”


<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]



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

Sign out from the cPanel, and clear the cache from the browser, and then test the changes.

Leave a Comment