How to force SSL (https) with .htaccess

LTB-Academy-Blog-Image-ssl-2.png

If you wish to force your entire website to go through https, you can add these rules to your .htaccess file. (You can access your .htaccess file with a FTP or with the File Manager).

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]

If your site is in a subfolder, use this code:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://yourdomain.com/folder/$1 [R,L]

Replace yourdomain.com with your domain name and it will work!

scroll to top