Use .htaccess to redirect 2 directories to https, and all others back to http
I've been able to find related answers to my problem, but mine combines a couple of the issues (multiple directories and redirection back to http), and I'm not sure how to best proceed.
I have 2 directories 开发者_JAVA技巧that need to be forced to https, but as soon as the user leaves those directories, they need to be redirected back to http.
Currently, I'm using this code to redirect the right folders to https.
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} careers
RewriteRule ^(.*)$ https://70.39.248.80/$1 [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} career_management
RewriteRule ^(.*)$ https://70.39.248.80/$1 [R,L]
How could I edit that to redirect everything else back?
Thanks so much!
RewriteCond %{HTTPS} =off # HTTPS is off
RewriteCond %{REQUEST_URI} /(careers|career_management) # needed directories
RewriteRule ^(.*)$ https://70.39.248.80/$1 [R,L] # redirect to HTTPS
RewriteCond %{HTTPS} =on # HTTPS is on, but it shouldn't
RewriteRule ^(.*)$ http://70.39.248.80/$1 [R,L] # redirect to HTTP
精彩评论