How to solve "ExpiresActive not allowed here" error message in .htaccess file?

I am trying to add Expires headers to the HTTP responses of the site I am working on. The only way for me to control the Apache 1.3 server is by editing my .htaccess file. I tried adding code such as the following to enable the Expires headers:

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 1 hour"
</IfModule>

However, this results in an internal server error with the following error message in the log:

ExpiresActive not allowed here

I probably cannot use alternative methods of cache control, since mod_headers is not enabled. Is there any way I can still enable the Expires header using mod_expires through some commands in the .htaccess file?

Update
I recall reading somewhere that the Override settings in httpd.conf might have something to do with it. Is there any way to validate that that is indeed the problem? If it is, is there some workaround to control caching headers for my website anyway?


Solution 1:

On a general note, the simplest way to deal with issues like this is referring to the manual.

http://httpd.apache.org/docs/1.3/mod/mod_expires.html#expiresactive

Syntax:      ExpiresActive On|Off
Context:     server config, virtual host, directory, .htaccess
Override:    Indexes
Status:      Extension
Module:      mod_expires

The two fields of interest it Context and Override. As we can see its OK to use ExpiresActive in an .htaccess file aslong as you AllowOverride Indexes

Update:

To address your need for expire headers. Check out https://stackoverflow.com/questions/1036941/setup-expires-headers-php-apache

Hope this helps:)

Solution 2:

Adding "AllowOverride Indexes" to Apache's conf for the folder where you have htaccess in worked for me. Found the solution here http://speedforce.org/2009/01/were-back/