RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
There are a few ways to implement this change on a server. Especially if you are looking to stop redirect chains or target SSL traffic, etc.
This is a very basic “Send all non seceure traffic to secure socket layer”.
Dont do this if you Don’t Have an SSL certificate!
Additionally, to stop redirect chaining, you can look for individual conditions to match:
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.example.com.au%{REQUEST_URI} [R=301,L]