Forcing https on Rackspace Cloud Sites

I just had one heck of a time trying to force https:// on a site using .htaccess. All of my attempts resulted in a To many redirects error.
The fix was to modify the RewriteCondition to look at environmental variables.

Notice the use of %{ENV:HTTPS} rather than the traditional %{HTTPS} you find when doing a google search.

RewriteEngine on
RewriteBase /
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$$1 [R,L]

Leave a Reply

Your email address will not be published. Required fields are marked *