To redirect all http:// traffic to the corresponding https:// traffic, we make use of a bit of mod_rewrite magic.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
Replace www.example.com with your own SSL URL.
To force SSL for a particular folder (not the entire site), use the following instead:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://www.example.com/somefolder/$1 [R,L]
Replace somefolder with your folder path and www.example.com with your SSL URL.
(original article taken from this blog)
You must be logged in to post a comment.