Knowledge Base

How to setup redirection to https using .htaccess file

Once you’ve setup SSL on your account, it is recommended to make sure all of your web traffic comes from https instead of http.

To force usage of https, follow this process.

1. In cPanel, goto File manager

2. Navigate to your domain’s webroot

Open public_html folder and/or webroot directory of domain you want to configure this redirection for

3. Open .htaccess file for editing

Find .htaccess file. If you are using WordPress or similar CMS, it’s sure to be present. If you cannot see it, click on Settings in top right most corner.

Now check “Show Hidden Files” and Click save.

If you still don’t see it, create a new .htaccess file.

Now select this file and click edit from toolbar.

3. Add the redirect code

Paste the following code to top of the file.

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

and click save

That’s it. You can test redirect by manually visiting http://yourdomain.com or using a tool like Redirect Checker.

If you are lost in any of these steps, you can always open a ticket and we’ll help out!

Stuck? We can help!
Updated on