I want to force ssl access on an entire site, except for the following pages:
www.example.com/loans_and_lines/home_loans.html www.example.com/cardswww.example.com/cards/international-ministries.htmlwww.example.com/cards/international-ministries/donation-3.htmlwww.example.com/locations_and_contacts/
Force ssl:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/personal/loans_and_lines/home_loans\.html
RewriteCond %{REQUEST_URI} !^/cards/$
RewriteCond %{REQUEST_URI} !^/cards/international\-ministries\.html
RewriteCond %{REQUEST_URI} !^/cards/international\-ministries/donation\-3\.html
RewriteCond %{REQUEST_URI} !^/locations_and_contacts/$
RewriteRule (.*) https://www.example.com$1 [R=301,L]
However neither of the /cards or /locations_and_contacts and any of the pages are being excluded from being served with ssl access. Can someone tell me what’s wrong with my set of rules?
🙂
…
You forgot the “OR” directive. Here’s what should work (and maybe you’ve forgotten the QSA directive in the redirect as well (maybe not)):
Two hints:
Please try to use the
RewriteLogdirective: it helps you to track down such problems:My favorite tool to check for regexp:
http://www.quanetic.com/Regex (don’t forget to choose ereg(POSIX) instead of preg(PCRE)!)