I wish to pressure SSL access with an entire site, except for an additional pages:

world wide web.example.com/financial loans_and_lines/home_financial loans.html

world wide web.example.com/cards

world wide web.example.com/cards/worldwide-ministries.html

world wide web.example.com/cards/worldwide-ministries/donation-3.html

world wide web.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 from the /cards or /locations_and_contacts and the pages are now being being excluded from being offered with SSL access. Can someone let me know what is wrong with my algorithm?

-Tony

:)

...

You didn't remember the "OR" directive. This is what should work (and perhaps you've forgotten the QSA directive within the redirect too (not)):

# Force SSL
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/personal/loans_and_lines/home_loans\.html [OR]
RewriteCond %{REQUEST_URI} !^/cards/$ [OR]
RewriteCond %{REQUEST_URI} !^/cards/international\-ministries\.html [OR]
RewriteCond %{REQUEST_URI} !^/cards/international\-ministries/donation\-3\.html [OR]
RewriteCond %{REQUEST_URI} !^/locations_and_contacts/$
RewriteRule (.*) https://www.example.com$1 [QSA,R=301,L]

Two hints:


Please use the RewriteLog directive: it allows you to find such problems:

# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On

My personal favorite tool to check on for regexp:

http://www.quanetic.com/Regex (be sure to choose ereg(POSIX) rather than preg(PCRE)!)