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 compressionAddOutputFilterByType 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/htmlBrowserMatch ^Mozilla/4\.0[678] no-gzipBrowserMatch \bMSIE !no-gzip !gzip-only-text/htmlBrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html</IfModule><IfModule mod_headers.c># Make sure proxies deliver correct contentHeader append Vary User-Agent env=!dont-vary# Ensure proxies deliver compressed content correctlyHeader append Vary Accept-Encoding</IfModule></IfModule># END Compression (DEFLATE)
code>
Make sure ExpiresActive ON installed inside your FilesMatch directive before ExpiresDefault .