I just created my first encrypted (https) site. I was advised that it might be best to use https in my "canonical" links and use my .htaccess file to redirect traffic to the new https links. I found the code for that task here.
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
It works fine online. The problem is that it messes up my local sites. It isn't a huge problem; I could simply make separate .htaccess files - one for online and one for local use. But that would be a minor pain, so I wondered if there's another solution.
My local pages won't display at https, so I wondered if there's a way to tell my .htaccess file to make this new rule apply online only.
EDIT:
Maybe I should reword my post to ask how YOU handle this situation. I'm not even sure if .htaccess is the only player here...