.htaccess forwarding

After buying a SSL certificate for my site I wanted to forward all of my traffic to my new secure space. I did this by editing the .htaccess file in my sites directory.

Warning! You must make a back up of your original .htaccess file just in case . . .

I added this at the front of all the existing code:

——-

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

——-

Code Source

Other .htaccess documentation