Are you wondering how to redirect to SSL via htaccess? Alot of users won’t type in the https or even http for that matter so if your site has an SSL certificate you will want to make sure your visitors get redirected to the secured site. This is very useful for websites with a secure layer. I will explain in this post exactly how to achieve this.
Presuming you have an Apache server, first off you will need to create a .htaccess file and put the following code in:-
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
What does the above code do? The first lines tells Apache that we want to use the mod_rewrite module, the second line checks whether HTTPS is off, the third line forces https.
Once you are happy simply upload the file to the root directory of your website.
I hope this helps some of you out there.
Might be also worth providing some resources on how to do this on lighttpd and ngix,
http://redmine.lighttpd.net/wiki/1/HowToRedirectHttpToHttps
http://forum.slicehost.com/comments.php?DiscussionID=1520
Thanks for that Leon
I will do seperate posts for them.