Site icon TechWonda

Mod_Pagespeed – How To Clear Cache For Css & Template Edits

Google Pagespeed

Google Mod Pagespeed

Google’s mod_pagespeed for Apache and Nginx can speed up your website and make it load 10 times faster. The reason for the speed boost is that the mod_pagespeed module minifies and caches everything, storing and loading them from a separate location. This means that when you make changes to your website (eg. by adding a new css class to one of your stylesheets), your changes will not be visible until you clear the mod_pagespeed cache. Doing a browser hard refresh won’t help.

What If I Wait for the Cache to Flush Automatically?

I believe mod_pagespeed does some self flushing after some time. I am not sure of the exact duration, but it can take days for the module to flush its cache and fetch fresh files from the origin. If your changes are important, you might want to look into deleting the cache files manually.

How To Clear the Mod_Pagespeed Cache

I use mod_pagespeed on all my sites, including this one. The first time I encountered this problem was when I changed the css for one of my websites. I cleared the sites cache and did a hard refresh but nothing happened. I googled a little and found some sources (some old) that would give you a code to run in the command line which would create a cache.flush file in the mod_pagespeed directory.

Long story short. It doesn’t work. It probably used to work but it doesn’t work anymore.

So how did I do it?

I went in and deleted the cached css file.

Exit mobile version