specific file for leverage browser caching

2k views Asked by At

I have added below code in htaccess

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ## 

But still I am getting some files to add for leverage browser caching.

Can I add specific files in .htaccess for leverage browser caching?

1

There are 1 answers

0
Ildar Amankulov On

You cannot.

http://httpd.apache.org/docs/current/mod/mod_expires.html

Apache Module mod_expires supports 3 directives

  • ExpiresActive
  • ExpiresByType
  • ExpiresDefault

The syntax of the ExpiresByType directive is

http://httpd.apache.org/docs/current/mod/mod_expires.html#expiresbytype
ExpiresByType MIME-type <code>seconds

or

http://httpd.apache.org/docs/current/mod/mod_expires.html#AltSyn  
ExpiresByType type/encoding "base[plus num type] [num type] ..."