Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Header set or append?

What is the difference if any?

3:40 pm on Dec 2, 2013 (gmt 0)

Preferred Member

10+ Year Member

joined:May 21, 2004
posts: 385
votes: 5

I recently came upon a situation where I was using php and ajax to open a 'modal' after button click. I could not for the life of me understand why the dynamic content inside the modal was not updating after the first time it was clicked.

My htaccess had :

<FilesMatch "\.(html?|php)$">
ExpiresDefault "access plus 2 days"
Header append Cache-Control "private, must-revalidate"

I changed this to the following and now all was fine :

<FilesMatch "\.(html?|php)$">
ExpiresDefault "access plus 0 seconds"
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
Header set Pragma "no-cache"

I had looked up some information on proper 'nocache' settings and did a simple copy paste.

This, however, bought up the question... what is the difference between 'Header set' and 'Header append'?

From a working standpoint I see no difference. I changed new code to append and it worked fine. I have used append in these rules for years not thinking twice until now. I did some searching and didn't come across much.

What is the difference between these two? Logic of course says one is appended (added to the end), but what is the real difference here?
5:04 pm on Dec 2, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 597

You can think of it as analogous to [QSA] in mod_rewrite. With "Header append" you will potentially end up with two different values for the same thing. And then the recipient-- in this case the browser-- has to decide which one to use. So if your existing Cache-control and/or Pragma header already has a default value that's different from what you're now saying, the browser might choose to go with the first thing it sees.