Forum Moderators: phranque
# BEGIN non-www to www with https
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.example.com/$1 [R=301,L] # BEGIN non-www to www with http: (host canonicalization for /somefolder/ requests)
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} on
RewriteRule ^(somefolder/.*) http://www.example.com/$1 [R=301,L]
# BEGIN non-www to www with https: (host canonicalization for all but /somefolder/ requests)
RewriteCond %{REQUEST_URI} !^/somefolder/
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
RewriteCond %{HTTPS} !on
Add a htaccess file in /somefolder/ which 'disables' the https redirect... how that would be done though I don't know.
For the excluded directory, do you want to allow both http and https, or do you need it to be http alone?
# BEGIN non-www to www with https: (host canonicalization for all but /somefolder/ requests)
RewriteCond %{REQUEST_URI} !^/somefolder/
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [OR]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.example.com/$1 [R=301,L]