Copy this code into your htaccess file. Then replace the yourdomain.com.au with your website domain name. You only need to use this code if your are not using a CMS like WordPress. It works well for basic HTML websites for example.
—————————–
RewriteOptions inherit
RewriteEngine on
# If the hostname is NOT yourdomain.com.au
RewriteCond %{HTTP_HOST} !^yourdomain\.com\.au [OR]
# Or if non SSL request
RewriteCond %{HTTPS} !=on
# 301 redirect to the same resource on yourdomain.com.au
RewriteRule (.*) https://yourdomain.com.au%{REQUEST_URI} [L,R=301]
——————————