How to get Apache2 to parse (without error) Header directives in a .htaccess

.htaccessapache-2.2http-headers

I am getting pages loading with a 500 internal server error, due I believe to a directive that Apache has not been configured to allow.

I have AllowOverride set to all, and a .htaccess file, including:

<FilesMatch "\.(eot|ico|pdf|flv|jpg|jpeg|png|gif|svg|swf|ttf|woff)$">
Header set Cache-Control "max-age=31536000, public"
Header set Expires "Wed, 23 Apr 2014 17:00:01 UTC"
</FilesMatch>

/var/log/apache2/error.log has:

[Sat Jul 20 15:12:36 2013] [alert] [client 24.15.83.241] /home/jonathan/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

What do I need to specify so that Apache2 will properly handle the 'Header' directive?

Best Answer

With apache2, just run a2enmod headers and then sudo service apache2 restart and it will install the headers module automatically.