How To Fix Apache Error: Invalid command ExpiresActive

How to fix the Apache Error

By Tim TrottLinux Tips and Tutorials • June 30, 2012
How To Fix Apache Error: Invalid command ExpiresActive

If you're getting this message on your Apache installation and a 500 Internal Server Error message, you've used the ExpiresActive command in a .htaccess file or the apache2.conf (or httpd.conf) file without including the Expires module.

Fortunately, it's an easy fix, especially on Ubuntu systems:

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 expired 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 enable them. If that fails, you may need to edit the .htaccess file using mod_expires and comment on it. You can use Headers instead. It's not as flexible, but it 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>

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

My website and its content are free to use without the clutter of adverts, popups, marketing messages or anything else like that. If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

This post has 3 comments. Why not join the discussion!

New comments for this post are currently closed.