%{HTTPS} =on syntax is wrong for some servers
-
Hello, I have a client using the plugin, and no matter what combination of settings we tried, the pages were just never cached (I checked the end of the page markup for that comment which is proof of caching). I checked the changes it did to .htaccess and it seems like there is a potential bug in the code, specifically in the
prefixRedirectfunction from inc/admin.php:$forceTo = "\nRewriteCond %{HTTPS} =on"."\n"should be:
$forceTo = "\nRewriteCond %{HTTPS} on"."\n".ChatGPT explains it very clearly:
This is incorrect usage in Apache. It does not evaluate the way the plugin author thinks.
- Apache sets
HTTPSto"on"only if SSL is active, but using=onmakes the rewrite condition true only when HTTPS is exactly equal to “on”, which isn’t how it should be checked in.htaccess. - Worse, mod_rewrite expects a regex, so
=onis not interpreted reliably across servers.
✅ Correct Usage:
Replace:
RewriteCond %{HTTPS} =onWith:
RewriteCond %{HTTPS} onI made that change and now the pages are cached. Could you please include this fix in the next releases, so we don’t have to keep manually modify that line after each update? My client also has the paid version of the plugin.
The page I need help with: [log in to see the link]
- Apache sets
The topic ‘%{HTTPS} =on syntax is wrong for some servers’ is closed to new replies.