Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Problems with Apache and "Expires" headers

Setting ExpiresActive result in server error



9:32 pm on Jul 26, 2003 (gmt 0)

10+ Year Member


I'm trying to control the caching of my web content by adding the ExpiresActive directive to the .htaccess file in the /public_html directory of my site.

I put the following lines (straight from the Apache manual) into the .htaccess file but get the dreaded Internal Server Error.

ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType text/html M604800

In fact, just placing the line 'ExpireActive On' into .htaccess results in an error.

Here's the the error log entry:
[Sat Jul 26 16:09:57 2003] [alert] [client] /home/dondle/public_html/.htaccess: Invalid command 'ExpiresActive', perhaps mis-spelled or defined by a module not included in the server configuration

My host provider, running Apache 1.3, says that the mod_expires and mod_headers modules are installed into httpd and says he doesn't know what the problem might be since he is not familiar with the mod_expires directives. Are there any other possible causes?



10:02 pm on Jul 26, 2003 (gmt 0)

10+ Year Member

i remember playing with this on my apache 1.3 server... it took me a few attempts to get it all working but that was a few years back... sadky, i can't get to my .conf file either for more detailed info on what i did... i do, however, have a question...

do you have a ExpiresDefault directive defined?

also, is the server owner absolutely sure that mod_expires is loading? the errormessage in the log indicates that the module is not loading since it is obvious that you haven't misspelled it...


12:20 am on Jul 27, 2003 (gmt 0)

10+ Year Member


Thanks for getting back.

What can I tell the web host to look for to verify that it's loading? He says they recompiled the modules into the http daemon for me and that everything looks good from their end.

How would I be sure taht the 'ExpiresDefault' directive is defined?

Unfortunately, I've only briefly run Apache on an old Debian Linux box I had. I really don't know much about administering it. The web host will give me jail shell access. Maybe I could use that to look at the appropriate .conf files...if I knew what they were. :(


12:57 am on Jul 27, 2003 (gmt 0)

10+ Year Member

if they've compiled the modules into the executable, then the module should be available... i've not run a monolithic compilation in a long time... there may be a config option that they need to set in the conf file... there is also a set of command line parameters that they can run that will list all the modules included in the executable...

httpd -l (that's an ell not a one)

is the one... just found it on the apache.org site...

otherwise, it should be listed in the httpd.conf file as a lodable module instead of being compiled in... generally the syntax is

LoadModule expires_module modules/mod_expires.so

(the above is for a *nix shared object version of the module)

if they do have the module compiled into the server, it still may not be active... that would be done like this...

AddModule mod_expires.c

in the conf file...

the expiresdefault directive can be set in your .htaccess file...

generally the conf file is /etc/httpd.conf on most *nix systems... but it can be anywhere and called anything because another of those command line parameters sets the config file to use 8)

in any case, until you can get it to stop telling you that the word is undefined, your task is to get the module loaded and active...

you may find additional info over at [httpd.apache.org ]... its where i was looking to verify some of the info above...


2:29 am on Jul 28, 2003 (gmt 0)

10+ Year Member

Thanks again. My web host is now saying that they can't install mod_expires because Apache won't restart properly. Who knows. I give up. I guess it's time to post a message asking how to control file expiration without using the ExpiresActive directive.


1:53 am on Jul 29, 2003 (gmt 0)

10+ Year Member

Granted, you're to know better, but if I were you, I'd have changed the host ASAP. mod_expires comes by default with every Apache install and works just out of the box. It's very unprofessional of them to be unable to make it work.

Although it's possible to control expiration headers with server-side scripting, the overhead and the trouble make it really not worth it.


Featured Threads

Hot Threads This Week

Hot Threads This Month