I have the following:
RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} protected [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301] RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !protected [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301]
If the directory is called "secure", make sure the user uses https. If the directory has nothing but "secure", make sure the user uses http.
This works fine, but how do I specify additional directories?
Also, is there a way to do this without having to specify directories twice? Once to include it and once to exclude it?
Thanks!
UPDATE
Although my “protected” folder was forced to use https because of my rules, any links to images, stylesheets, and javascripts that were not in the “protected” folder were still redirected to http. This causes the protected page to be partially protected. Adding the following to the redirect code solves the following:
RewriteRule \.(css|gif|jpe?g|js|png|swf)$ - [L]
source share