Where technology and gadgets come together and play

Apache Error: Invalid command ExpiresActive

Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration

Written By on in Linux

228 words, estimated reading time 2 minutes.

How to fix Apache Error: Invalid command ExpiresActive which can occur when a misconfigured server has a configuration file is misspelled or defined by a module not included in the server configuration.

If you’re getting this message on your Apache installation, coupled with a 500 Internal Server Error message, it means you’ve used the ExpiresActive command in a .htaccess file or in the apache2.conf (or httpd.conf) file without including the Expires module. Fortunately, it’s an easy fix, especially on Ubuntu systems:

Simply run as root:

ln -s /etc/apache2/mods-available/expires.load /etc/apache2/mods-enabled/

On non-Ubuntu/Debian systems, you’ll need to edit the apache2.conf (or httpd.conf) file to enable the module. See the Apache Documentation here for more info.

Once that’s done, restart your Apache2 server:

service apache2 restart

Your server will now have the expires module installed and the error message should be gone!

If you do not have shell access to the server or your web host controls modules you may need to speak with them to get it enabled. If that fails, you may need to edit the .htaccess file which is using mod_expires and comment it out. You may be able to use Headers instead. It's not as flexible, but can still be made to work, especially if all you need is a far future expires.

<FilesMatch "\.(jpg|png|gif|js|css|jpeg|ico)$">
  Header set Expires "Mon, 1 Jan 2020 12:00:00 GMT"
  Header set Cache-Control "max-age=29030400, public"
</FilesMatch>

Last updated on: Saturday 1st July 2017

 

Comments

There are no comments for this post. Be the first!

 

Leave a Reply

Your email address will not be published.





If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.

Copyright © 2001-2018 Tim Trott, all rights reserved. Web Design by Azulia Designs

This web page is licensed for your personal, private, non-commercial use only.

Disclaimer, Privacy & LegalSitemapContact Me