最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I leverage browser cache for minified JS or minified CS files?

programmeradmin1浏览0评论

I am absolutely comfortable utilizing HTACCESS but I am working on speed load. I have a minified JS file. How would I go about adding this into my HTACCESS?

Below I was going to add this line to htaccess to leverage browser cache for minified JS file.

    ExpiresByType application/js.min A31536000

I am absolutely comfortable utilizing HTACCESS but I am working on speed load. I have a minified JS file. How would I go about adding this into my HTACCESS?

Below I was going to add this line to htaccess to leverage browser cache for minified JS file.

    ExpiresByType application/js.min A31536000
Share Improve this question asked Feb 5, 2017 at 21:29 RobRob 446 bronze badges 1
  • Plz elaborate the problem – meDeepakJain Commented Nov 4, 2019 at 5:08
Add a comment  | 

1 Answer 1

Reset to default 1

Yeah, you can do leverage browser caching for minified js & css files same as we do for other files.

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

You are talking about speed, for that you can add gzip or deflate in htaccess.

发布评论

评论列表(0)

  1. 暂无评论