0

I've set up a htaccess file to cache data on my website for speed optimization. However, I have the issue that some of my "external" sites on my webserver are therefore not updated unless forced to do so. Specifically, the following page I would like to avoid having to change version name on to update:

http://canlogger.csselectronics.com/downloads.php?q=canvas

I.e. this page loads content from a folder on my server unto a website. The problem is that the files in the folder, as well as the loaded release doc info is not updated automatically as it has been cached. This I would like to avoid (but keep caching for e.g. images etc.)

My htaccess looks like this:

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

Any help would be appreciated! Martin

Brad
  • 146,404
  • 44
  • 300
  • 476
Martin
  • 157
  • 2
  • 11

1 Answers1

0

First off, you shouldn't be using .htaccess files for this. On every single request, your web server has to load it, really making things inefficient. You should use a proper web server configuration that's loaded on start.

Next, you shouldn't let the web server dictate the caching control in this case. Your PHP script knows when its underlying data changes and can handle creating proper cache control headers, as well as generating an appropriate etag. See also: https://stackoverflow.com/a/4485194/362536

Brad
  • 146,404
  • 44
  • 300
  • 476