I added the code below to my .htaccess file to enable caching files for 3 days. After that my website wasn't available anymore and I got a message displayed that told me it's an Internal Server Error

The code:

 # 3 DAYS 
    <FilesMatch "\.(html|css|js|gif|jpg|jpeg|png|ico|swf)$"> Header set Cache-Control "max-age=259200, proxy-revalidate" </FilesMatch>

The message:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@exampple.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

What is wrong with the FilesMatch or what else could cause the Internal Server Error? Thanks

Accepted Answer

It has to be on multiple lines, not all in a single line. This one works fine for me:

<FilesMatch "\.(html|css|js|gif|jpg|jpeg|png|ico|swf)$">
    Header set Cache-Control "max-age=259200, proxy-revalidate"
</FilesMatch>   
Written by LazyOne
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki