Php and htaccess how to disable image cache in only one directory

I have a htaccess file in my root with cache instructions:

<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 image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>

Now I just noted that when I download an image with php / ajax, the image is displayed in the root for the first time in the image preview, however, if I reload / overwrite the image, the view does not change, possibly for htaccess caching.

is it possible to delete chache only in the / upload / directory, or is it better to disable chache only when downloading / previewing a php script, since the preview always displays correctly?

+3
source share
1 answer

Add another .htaccess file to the download folder using

ExpiresActive Off

Or ExpiresByType for images with 0 seconds

- script:

src="/uploads/image.jpg?<?php print time(); ?>"
+4

All Articles