Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder with this file: channel.html

In the same folder I have this .htaccess file

<Files channel.html>
ExpiresActive On
ExpiresDefault A31536000
Header set Cache-Control "max-age=31536000"

curl -I /channel.html:

HTTP/1.1 200 OK
Date: Wed, 09 Nov 2011 17:27:30 GMT
Server: Apache
Accept-Ranges: bytes
Cache-Control: max-age=0, no-cache, no-store
Vary: Accept-Encoding
Content-Length: 59
Content-Type: text/html

If I add ForceType text/plain on .htaccess it works as it should, but with the wrong Content-Type, obviously.

What should I do to fix or debug this annoyance?

share|improve this question
ExpiresDefault "access plus 1 year" would be much easier to read than that mess of numbers which does the same thing. – Chris S Nov 9 '11 at 18:18

Since the Expires header is working for text/plain but not for text/html, have you tried adding ExpiresByType text/html "access plus 1 year"? Or, searching the rest of your configuration for an ExpiresByType text/html directive somewhere else, that's overriding your default?

share|improve this answer

You may have something resetting your headers. If this is a script and not straight static content, then your web application may also be setting cache headers.

Also, I see you are using mod_page speed. I know it tries to do some optimizations, perhaps it is setting headers for you too.

I would try this: Header unset Cache-Control in your .htaccess and see if you still get a Cache header. If you do, then you know that the cache header is being injected somewhere else.

By changing the mime/type, it suggests that whatever is setting the header is doing so just for text/html so it does not touch text/plain.

share|improve this answer

Have you enabled headers rewriting ? if you can spot Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration

in apache2/error.log, then you may want to run sudo a2enmod headers

as recommended in

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.