I've done this before successfully, so it confuses me that I'm failing at it now. My goal is to make any attempt at a non-
https URL redirect to its
https counterpart
except for files in the
/images/ directory, since those will be used in some emails. Instead, the
.htaccess file below is causing browsers to attempt an infinite loop of redirection, ultimately hitting an
ERR_TOO_MANY_REDIRECTS error. That behavior could imply that I had forgotten the first
RewriteCond termination condition below, except that I hadn't.
Thanks in advance for your help! Code:
RewriteEngine On
RewriteBase /
DirectorySlash On
# Force https: on everything except images: (e.g., for emails)
RewriteCond %{HTTPS} off
RewriteCond %{SCRIPT_FILENAME} !^/images(/|$)
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,QSA,L]
Robin
The 2nd Amendment, 1789 - The Original Homeland Security.
Gun control means never having to say, "I missed you."