Do you have questions ? We got the answers!

Ask a question:

0
redirect all http requests to use https in cpanel

Open 1 Answers 33 Views Shared Web Hosting
I currently use cPanel and I have shared hosting. Can you tell me how redirect all http requests to use https?

1 Answer

0

Hi,

Linux-based accounts use .htaccess files to handle redirection.

If you are creating a new .htaccess file, you can create is using your cPanel's file manager.

Then write the following code. 

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

It will automatically redirect users to HTTPS version of your website.

If the .htaccess file exists already, then:

  • Do not duplicate RewriteEngine On.
  • Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On.
answered by (750 points)
...