I am hoping to have some .htaccess expires headers stuff be conditional based upon the current environment. For example, the following would only be active if it were the production server, as opposed to local development:
ExpiresByType image/png "access plus 1 month"
It is annoying to have to clear cache during development constantly. Any ways around this?
Thanks 🙂
Yup, use your browser in Private AKA “Porn Mode” during testing. Chrome allows this on a per window basis. In this mode, any caching, 301 redirect info is cleared when you close and reopen a session. You can also clear history over the last hr / day / week. This is what I do.
In terms of Expires, etc. AFAIK there is no mechanism for embedding conditionals for ExpiresByType however is its trivial to bookend such lines with “
##--START-DEV” “##--END-DEV” lines and write a trivial sed script (or windows equivalent) to rewrite the.htaccesscommenting out or re enabling lines between such bookends.