css - Caching: Set expiration date for images -


in order improve loading speed of webpage want set expiration date images. not sure though how this.

i loading image through css, through cloudfront s3 bucket in aws. specify expiration date?

this example of how load pics:

.bg-header {   background: url("https://dt25rte355.cloudfront.net/assets/12456.jpg");    background-size: cover;   height:480px; 

in directory containing files, create new file called .htaccess , add following inside:

<filesmatch "\.(gif|jpg|jpeg|png)$">      header set cache-control "max-age=172800" </filesmatch> 

you can add additional file types regular expression, , apache add specified header every image request. note method require files hosted on server.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -