1. Home
  2. SSL/TLS
  3. How do I redirect my site from http (without SSL) to https (with SSL)?

How do I redirect my site from http (without SSL) to https (with SSL)?

To redirect all links on a website from HTTP to HTTPS you can add the following code to the top of the .htaccess file for the site:

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

For the redirect to work you need to put this code into the very top of the file exactly as it is written above. No editing of this code is needed.

You can use the File Manager in cPanel to edit your .htaccess file (or to create one if it does not exist). Keep in mind that you need to activate viewing of hidden files to be able to see the .htaccess file.

Was this article helpful?

Related Articles