This is something for me I can never get right. I have tried lots of different methods but none of them seem to be working for me.
I want to force all traffic trying to access HTTP to be automatically redirected to HTTPS.
My .htaccess looks like this:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www.)yourdomainname.com
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Not sure if it's relevant but my website is running on a VPS using Apache.
If someone could help me with a solution and what I was doing wrong it would be greatly appreciated.
EDIT: Here is my httpd.conf file: http://pastebin.com/VMYXGi0X