If you use a shitty server/network or your wordpress theme/plugins/content combination is heavy you can speed up the loading on the side of the client and server side by using a plugin like “W3 Total Cache”; it could set easily the browser needed headers to avoid hops, and also cache things like DB queries, or a in-server cache to save a static copy of the php files pre-generated as static content. The installation it just with a few clicks, the configuration the first time maybe take some time to understand, but once you do it, it is a straight forward procedure, by just enabling some type/s of cache or another according the kind of server that you are using or desired level of cache…
But beware in some cases if you server is not fast enough it can cause the adverse effect!
So here is a clean/neat solution [if you are on linux] to archive at least the browser cache.
Edit the .htaccess file and add something like:
ExpiresDefault "access plus 1 day"
ExpiresByType text/html "access plus 1 week"
ExpiresByType image/jpg "access plus 1 month"
Header append Cache-Control "public"
This is just a example, as you can see you can set different expiration headers per mime types… [also by file extension, and [lot?] of other parameters]
Tech Note: the header will be constructed as:
Cache-Control: max-age=172800, public
If you need for some rare reason (External cache CDN provider compatibility, better look a like, some standard, etc ) the header like this:
Cache-Control: public, max-age=172800
Just add at the end of the .htaccess file (inside the “IfModule mod_expires.c”) this:
<IfModule mod_headers.c>That will invert the order of the values…
Header edit Cache-Control "max-age" "public, max-age"
Or directly write the full header [on the order that you want] like this:
Header set Cache-Control "max-age=172800, public"
If you are on windows I guess that there is a “rewrite” rule or something similar to address this issue, but as it weren’t the case, you will have to research by yourself…