How to force SSL (HTTPS) with htaccess?

To force an SSL (HTTPS) connection on your website, add the following lines inside your website’s htaccess file (found in public_html):

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

  • SSL, htaccess, HTTPS, Secure, Encryption
  • 27 Users Found This Useful
Was this answer helpful?

Related Articles

Can I choose my PHP version?

Sure thing! Just login to cPanel and navigate to the 'MultiPHP Manager' icon. Give it a click,...

Do you have DDOS protection?

Absolutely! We are committed to protecting your hosting service 24/7 against any type of DDoS...

Do you support IPv6?

No doubt about it! We're living in the future, not in the past! Every single server that belongs...

How do I edit my php.ini file?

It can all be done through cPanel with just a few clicks! Just login to cPanel and navigate to...

What hosting control panel do you use?

We use the famous cPanel control panel. You can find a demo here.