Quick way to redirect a whole website to HTTPS

Quick way to redirect a whole website to HTTPS

Last updated:

Place this on a .htaccess file on the top level of your website. If your website is called http://my-website.com then every time someone tries to access it they will be redirected to the SSL version thereof.

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