0

I try to cache a .woff?v=4.6.3 file with .htaccess but this code doesn't works:

<ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>


<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 2 days"
  ExpiresByType image/jpeg "access plus 31104000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/javascript "access plus 216000 seconds"
  ExpiresByType text/html "access plus 3600 seconds"
  ExpiresByType application/xhtml+xml "access plus 3600 seconds"
</ifModule>

Do you have any suggestion ? (NB: I search solution in google and on this forum but I don't find an applicable solution)

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

You can try using the filesmatch directive

<IfModule mod_headers.c>
  <filesMatch ".(css|jpg|jpeg|png|gif|js|ico|woff)$">
  Header set Cache-Control "max-age=2592000, public"
  </filesMatch>
</IfModule>
Justin R.
  • 489
  • 1
  • 5
  • 12
  • Thank's, I try it but, it doesn't work, I the Google develloper tools message: use inificient cahce policy on static assets. The TTL continue to be 2 days. – Bâ Nandy Jun 16 '18 at 16:38