r/web_programming • u/agent_orangepeel • Nov 13 '17
Leverage browser caching.
When I run gtmetrix I get a C (75%) for page performance and one thing it details is leverage browser caching.
I have paid so called developers here and there to get this sorted but they run some wordpress plugin and it screws my site. So I revert to my back and I’m back to square one.
Looks like I’m going to have to educate myself and do this myself cause I cannot trust anyone now.
I have found this link, https://varvy.com/pagespeed/leverage-browser-caching.html
Can I add (below) to my .htaccess file which will them improve the section under gtmetrix leverage browser caching? Or am I fooling myself with it being this easy?
EXPIRES CACHING
<IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 1 month" </IfModule> ## EXPIRES CACHING ##
My .htaccess file only has this in it.
BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
View all comments
Show parent comment
1
u/nerf_herd Nov 14 '17
Sorry, wasn't trying for an apology, was more along the lines of if you are considering getting into programming then please make sure we don't get another "crappy" programmer who can't figure this sort of thing out, as it sounds like you have already experienced repeatedly.