Remove query strings from static resources to improve page speed

Recently, I discussed few steps to improve performance and decrease bandwidth. With Google now using page speed to rank pages in their search results it is all the more important to take care of loose ends that adversely affect your search engine optimization. Pingdom and GTMetrix are two tools that you could use to measure your page speeds. They look at various factors that affect page speed and grade your site's performance in each of the factors. One of the factors that has a high impact is the "Remove query strings from static resources" factor. This can occur if you have W3 Total Cache plugin in your WordPress. In this post, I will show you how to address "Remove query strings from static resources" problem.

Initial Pingdom and GTMetrix Scores

While trying to improve my page speeds, both Pingdom and GTMetrix pointed out that I have to "Remove query strings from static resources". This factor received low scores as shown in the images below:

Remove Query Strings From Static Resources
Pingdom Score - Before

Gtmetrix Score - Before
Gtmetrix Score - Before

Some of the items in the list were within my domain and some of them were from plugins, which I have no control over. I wanted to fix the items that were under my control.

Remove Query Strings from Static Resources

My research shows that a specific "Browser Cache" setting in W3 Total Cache plugin appends query strings to static items. It is the "Prevent caching of objects after settings change". Uncheck it, save your settings, and deploy the changes. This should now remove the query strings from static resources served from your domain.

Prevent Caching Of Objects After Settings Change
Prevent Caching Of Objects After Settings Change

Final Pingdom and GTMetrix Scores

After making the above change my Pingdom and GTMetrix scores improved. As shown below, there is still some room for improvement. But this has more to do with the plugins I have installed than the static resources in my domain. So unless I use other plugins or the plugin developers improve the code, it is hard to fix these.

Pingdom Score - After
Pingdom Score - After

Gtmetrix Score - After
Gtmetrix Score - After

Hope this helps. Go head remove query strings from static resources and speed up your wordpress. If you have other fixes that worked for you please share them with us in the comments section. Enjoy blogging!

Be the 1 in 200,000. Help us sustain what we do.
114 / 150 by Dec 31, 2024
Join Us (starting from just $1.67/month)

Anand

Anand is a self-learned computer enthusiast, hopeless tinkerer (if it ain't broke, fix it), a part-time blogger, and a Scientist during the day. He has been blogging since 2010 on Linux, Ubuntu, Home/Media/File Servers, Smart Home Automation, and related HOW-TOs.

Try Deployarr