Jump to content

Recommended Posts

Right, i've reached cache control on my TO-DO list of website improvements... I've read numerous articles and samples but I can get my head round what parameters I should be using.

 

I've got to this stage;

 

Header unset Pragma
FileETag None
Header unset ETag

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=172800, must-revalidate"
</FilesMatch>
# 1 Hour
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=3600, must-revalidate"
</FilesMatch>
# 2 DAYS
<FilesMatch "main.php">
Header set Cache-Control "maxage=172800, must-revalidate"
</FilesMatch>

 

The main.php file compresses my CSS file so I have set a specfic cache of 2days for that so it doesn't fall under normal php caching of 1 hour.

 

A few questions, I don't understand why i'm using public/private and must re-validate;

 

When should I use public or private?

When should I use must re-validate and what are other options/applications for this parameter?

 

Anything i'm missing here?

Link to comment
https://forums.phpfreaks.com/topic/226826-cache-control-htaccess/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.