Mobile app version of vmapp.org
Login or Join
Murray432

: Cache a particular image using .htaccess I would like to cache a particular image on my website i.e the background image. So far i only see options that allow you to define the format type(png|jpg|ico)

@Murray432

Posted in: #Cache

I would like to cache a particular image on my website i.e the background image.

So far i only see options that allow you to define the format type(png|jpg|ico) is there anyway to let the browser cache the background

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ravi8258870

I use the following to set far future expiration dates for all media files:

<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|ico|js|css|swf)(.gz)?$">
Header set Expires "Thu, 15 Apr 2020 20:00:00 GMT"
Header unset ETag
FileETag None
</FilesMatch>


and I'd recommend using it because it will help out on the bandwidth and speed front's but this code would allow you to set the expiry for a specific file.

<Files "test1.jpg">
ExpiresActive On
ExpiresDefault A60
</Files>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme