Making a directory ssl and all other pages/dirs not ssl
Fairly simple request.. I'd like to use mod_rewrite on apache开发者_运维百科 to make a directory redirect to ssl on my website, and make it so that it 'breaks out' of ssl when you navigate outside of that directory. Getting into https is easy enough using the following:
# Make gift-cards https
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} gift-cards
RewriteRule ^(.*)$ https://%{SERVER_NAME}/staging/$1 [R,L,C]
# Make all other pages normal
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !gift-cards
RewriteRule ^(.*)$ http://%{SERVER_NAME}/staging/$1 [R,L]
But breaking out proves to be a bit of a problem, I'm not really sure what's going on.. my make all other pages normal rule doesn't seem to work for some reason (and I get a funny 'Found' message if I don't use C to chain the two together).
Thanks!
I actually solved this by getting to the root of the problem and using wordpress SSL plugin which does it all for me.
I think I'd probably be barking up the wrong tree using this method as then I'd have to worry about all the resources getting loaded over http etc..
精彩评论