Redirect HTTP TO HTTPS Automatically

If you need to create a .htaccess file, you can use your control panel's file manager.

Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:

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

If you have an existing .htaccess file:

  • Do not duplicate RewriteEngine On.
  • Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On.
Was this answer helpful? 0 Users Found This Useful (58 Votes)

Powered by WHMCompleteSolution