how to remove Query Strings from Static Resources for SEO most frequently asked question and google suggestions for SEO and website speed optimization trick as now a days everyone wish to improve speed of website and when you analyze on google speed test google suggest you to remove query strings from static resources what actually it does mean and how can we remove it.Everyone want to sort out this issue but what exactly it is lets discuss about it

What are Query Strings?

Query strings are a part of a URL that doesn’t fit the normal hierarchical path structure. They are usually added to the URL as a part of a user-initiated process, such as a search or filling out a form, and define the interaction between a user/application and a database. The reason why query strings on static resources slow down page load times is that most of the proxy websites dont cache the websites pages and resources having query strings normally “? “in URL and the path of files linked to websites is considered as a query string.

Due to this reason the website downloads again and again for every visitor the contents and resources of your website fro every user and this takes lot of time as well slow downs the speed and server response as well instead of loading these resources from cache for a single user as well when he loads again and again a website all the resources are loaded again and again As Google have announced the speed is the most important ranking factor and google announced in 2010 about the load time as the ranking factor as well so that is the reason to improve the performance and speed of website as well ranking so its important to remove the query strings from the URL to improve the website speed and efficiency of server

How to Remove Query Strings

W3 Total Cache Plugin 

Very first way to remove query strings and very simple is W3 Total Cache Plugin  and in this method you can go to the plugin setting and there is an option to specify global browser cache policy there is an option to remove query string checkbox click on that and save all settings this will easily remove the query strings.

Now you can test your website and it will show much better results in speed on google pingdom and gtmetrics speed testing websites. below are simple steps to install and configure W3 Total cache for this option

  1. From Plugins->Add New in your WordPress control panel find W3 Total Cache.
  2. Click on Install.
  3. Go to the Plugins section in WordPress and activate the plugin.
  4. Find it in the menu to the left and open it.
  5. Look through the settings and find a setting called “Prevent caching of objects after settings change”. This setting is available for multiple file types.
  6. Uncheck the option for each file type.
  7. Save your settings.
  8. Re-check whether you still get the warning “Remove query string from static resources”.
  9. If not, you’re ready, if yes, maybe try the other method described here.
  10. W3 Total Cache is a powerful caching plugin so please look carefully through its options to make sure you get the most out of it and not damage your site’s performance instead! The plugin can handle minifying and inlining of resources .

Remove Query Strings from Static Resources without a Plugin

if you dont want to use the plugin as mentioned earlier W3 Total Cache then you can use a very simple method to go to your wordpress directory where you have installed theme

wp-content->themes->and the active theme in website  open that one and there will be a file named as functions.php file open this file and add the below line of code there this will easily do the same

function _remove_script_version( $src ){
$parts = explode( ‘?’, $src );
return $parts[0];
add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );
add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );

as done by plugin after making changes make sure your site is working fine if not then you can check some other options to that hope this will help you to resolve the issue of removing query string from static resources Good Luck.



Please enter your comment!
Please enter your name here