Score:0

Force caching 404 and 301 in .httaccess

kr flag

I'm trying to force Apache to cache 404, 410 and 301 responses. I've found this solution (which does exactly the opposite and many other example to avoid caching).

<IfModule mod_headers.c>
 Header always unset ETag "expr=%{REQUEST_STATUS} == 404"
 Header always set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" "expr=%{REQUEST_STATUS} == 404"
 Header always set Pragma "no-cache" "expr=%{REQUEST_STATUS} == 404"
 Header always set Expires "Wed, 11 Jan 1984 05:00:00 GMT" "expr=%{REQUEST_STATUS} == 404"
</IfModule>

These are the response headers from my server, I must delete them and tell the browser to cache the pages.

cache-control: no-cache, must-revalidate, max-age=0
expires: Wed, 11 Jan 1984 05:00:00 GMT

How should I change the code to cache error and redirects?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.