https://panelsecure.com/kb/59/
Disable Apache mod_cache for Dynamic Web Contents
Most web sites have large amounts of content that remains unchanged or is rarely modified after publication. Everytime it is requested from the web server, modified or not, it is reprocessed and transmitted to the client, unnecessarily consuming valuable server resources. As your website gains in popularity and more traffic is pushed, more resource load is put on the server to process requests, although the page contents are static, but dynamically generated.
To eliminate this problem and to speedup website performance, all PanelSecure servers are configured with Apache's mod_cache extension to boost response time of dynamically served web content. The mod_cache module in the Apache HTTP Server (httpd) is a standard HTTP web cache that is used to accelerate your website speed by caching dynamically generated pages.
Sometimes you may need to make sure that the user is not served the cached version of the page and you may need to disable this caching feature permanently on certain file extensions. This can be easily achieved by using the following code inside your .htaccess file.
In the example below you can find that we are disabling caching for the following file extensions "php|html|htm|js|css" you may modify this to disable caching for any file extension of your choice.
<FilesMatch "\.(php|html|htm|js|css)$"> FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" </FilesMatch> |
To disable caching for a specific filename, you can use the below code inside your .htaccess file. In the example below the caching will be enabled for all files and extensions on the server except the filename "index.php". Requests that are made to the file "index.php" will be served with the current dynamic version from the server and will not be cached.
<Files index.php> FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" </Files> |
After making the necessary changes the .htaccess file should be placed in the public_html folder. You may also place the .htaccess file inside any other folder of your choice that requires caching disabled.
.