.htaccess 500 internal server error installing ExpiresActive

In my .htaccess , I have this code:

 <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|txt|html|x-html|php|css|xml|js|woff|ttf|svg|eot)(\.gz)?$"> ExpiresActive On Header set Expires "Sun, 27 May 2012 00:00:00 GMT" Header unset ETag FileETag None </FilesMatch> 

It seems to work fine on some servers, but not on one of my sites. I get 500 internal server errors. Is there something wrong in the configuration, or do I need to contact my host?

+6
source share
1 answer

Make sure these Apache modules are enabled and loaded:

  • ExpiresActive - mod_expires
  • Header - mod_headers

Try this instead (it will only use directives if the corresponding module is present):

 <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|txt|html|x-html|php|css|xml|js|woff|ttf|svg|eot)(\.gz)?$"> <IfModule mod_expires.c> ExpiresActive On </IfModule> <IfModule mod_headers.c> Header set Expires "Sun, 27 May 2012 00:00:00 GMT" Header unset ETag </IfModule> FileETag None </FilesMatch> 
+28
source

Source: https://habr.com/ru/post/891831/


All Articles