adding ExpiresDefault to .htaccess file
Asked Answered
M

1

7

I have updated my .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 wont change for 1 month so they can cache they files.

I have 2 questions,

  1. Is this going to achieve what I want
  2. Since adding that I am now 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)

Merrell answered 12/3, 2011 at 18:48 Comment(0)
C
12

Make sure ExpiresActive ON is set inside of your FilesMatch directive before ExpiresDefault.

Callisto answered 11/4, 2011 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.