ExpiresDefaul...">

Adding an ExpiresDefault File to a .htaccess File

I updated the .htaccess file to include the following:

<FilesMatch "\.(css|js)$"> ExpiresDefault "access plus 1 month" </FilesMatch> 

I am trying to tell the client that all css and js will not change for 1 month so that they can cache their files.

I have 2 questions,

  • Will this be achieved what I want.
  • With the addition that now I am getting a 500 error, the whole .htaccess file is below:

     <FilesMatch "*\.(css|js)$"> ExpiresDefault "access plus 1 month" </FilesMatch> # BEGIN Compression (DEFLATE) <IfModule mod_deflate.c> # Enable compression AddOutputFilterByType DEFLATE text/css text/javascript application/x-javascript text/html ``text/plain text/xml image/x-icon <IfModule mod_setenvif.c> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html </IfModule> <IfModule mod_headers.c> # Make sure proxies deliver correct content Header append Vary User-Agent env=!dont-vary # Ensure proxies deliver compressed content correctly Header append Vary Accept-Encoding </IfModule> </IfModule> # END Compression (DEFLATE) 

code>

+6
apache .htaccess mod-expires web-hosting
source share
1 answer

Make sure ExpiresActive ON installed inside your FilesMatch directive before ExpiresDefault .

+11
source share

All Articles