Change Header Cache Parameters
Posted November 24th 2012, 4:52pm
@Dion: How do you disable the cache on the css? Did you do it for me last time? Or was that something else?
φ
Posts: 237
Joined: October 29th 2011, 11:00pm
Location: england, united kingdom, stoke on trent
Likes Given: 20
Likes Received: 4
Change Header Cache Parameters
Posted November 25th 2012, 1:30am
What was done on your board was combining all the individual CSS files into one file. It had nothing to do with changing the amount of time a file remains in a browser's cache.

On this board, I control the cache time using the header() function in the ddcss.php and ddmcss.php files. Since you serve a .css file, you can control the cache time by adding the following block of code to the .htaccess file in your root (public_html) directory:

<filesMatch "\.(css|js|ico|pdf|jpg|jpeg|png|gif)$">
Header unset ETag
FileETag None
Header set Cache-Control "max-age=605000, public, must-revalidate"
</filesMatch>

The above code will set the cache time to 605000 seconds, or approximately one week, for resource files served from your site.

Please be careful when editing .htaccess files...a mistake can cause everyone to lose access to your site!
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357

Who is online

Users browsing this forum: No registered users and 1 guest