Current time: 12-07-2019, 11:24 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistent results? Testing MySQL?
03-26-2011, 02:51 AM
Post: #5
RE: Inconsistent results? Testing MySQL?
oooohhhh, HostGator - yes, they have been mentioned before for their absurd policies about Gzip compression Sad - At a minimum you can gzip your php output directly by doing this: http://php.net/manual/en/function.ob-gzhandler.php but you should express your strong displeasure to them as well.

For the expires, I'd steer away from the .htaccess from your friend. I'm pretty sure the must-revalidate will pretty much defeat the purpose, and it does the matching based on file extension. If file extensions are good enough for you then removing the must-revalidate would get you there (though I generally prefer to use Expires in place of cache-control, either is fine).

Turning on caching is the easier part though - make sure you're prepared for the consequences before you do because once you turn it on the files will be stored on the user's computers and the only way to update them (change the css for example) is to change the file name and the references to it. The way I do this is to have a constant in one of my global files for the current version of the css (or javascript) files (like $CSS_VER='3'). Then everywhere in the code where the files are referenced I add a ?v=$CSS_VER query parameter to the files. The web server ignores the query parameter and serves up the file but the browsers include it as part of the file name so when they see a new version they download it from the server. People will frown a bit because SOME intermediary proxies will refuse to cache requests with query parameters and they recommend you put the version in the actual path but for me the tradeoff is worth it since it's easier to deal with (no rewrite rules, it just works).

Yes, even if you are using a CDN you should enable caching of the files. It's actually even more important that you do, otherwise the CDN itself will not be able to store a copy of your file and they will have to go back to your web server for every request anyway (which will actually make it slower).
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Inconsistent results? Testing MySQL? - pmeenan - 03-26-2011 02:51 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)