I've got an extranet (mywebsite.com/extranet) and would like to make sure that just this section is always under https, even if the user types the URL without https in it. Likewise (as a bonus, if possible, and if it doesn't add an unnecessary overhead), I'd like to make sure that the rest of the website is always http, even the user types https.
How would I go about doing this in the following .htaccess file (I'd rather not change the existing rules if possible as they seem to work well on my existing servers)? I've tried various pieces of code after searching around, but I can't get anything to play nicely with the existing rules. Also, I'd rather not use any third party add-ons as I'd like to keep my EE install as lightweight as possible, thanks.
Here's my existing .htaccess code:
RewriteEngine On
# Remove trailing slashes
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
# Add www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# Remove index.php from URLs
RewriteCond $1 !(^index\.php|(\.(gif|jpe?g|png|css|js)))$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]