Speed up your site by removing query strings

By removing query strings from your styles or scripts you can greatly improve your site performance.

Query strings are used in both javascript and style sheets, for example it is one of the methods that a plugin developer will use to render updates. Sometimes though the update is not visible until the cached file expires, and if you are using a CDN then that could take weeks or months.

By removing the query string it avoids you manually clearing your cache, and greatly improves your site performance and speed.

Simply navigate to your function.php and add this code at the bottom (don’t forget to do a backup of function.php, just in case)

 

function remaintenance_remove_query_strings( $src ){

    return remove_query_arg( ‘ver’, $src );

}

 

if ( !is_admin() ) {

    add_filter( ‘style_loader_src’, ‘remaintenance_remove_query_strings’, 15 );

    add_filter( ‘script_loader_src’, ‘remaintenance_remove_query_strings’, 15 );

}

Make your Website Faster with GZip

Gzip is a server side compression which will speed up your website. The speed at which your site loads plays an important factor in your rankings, as Google have publicly stated, they are obsessed with speed, and therefore we need to pay attention if we are serious about climbing the ranks.

There are many ways to speed up your site, from optimising images to clean code, all of which should be done to maximise our page load speeds. To test your site you can use Google’s own page speed insights which will test your site for mobile and desktop while providing you with tips on further optimising your site.

GZip compression not only speeds up your site but is also a good way to save on bandwidth. It is a very simple method to use and the results are fantastic.

To use this method, you just need to answer yes to the following-

1 – My site uses an apache server.
2 – I have or can create an .htaccess file.

Now add the following code to your .htaccess file –

 

# compress text, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript# Or, compress certain file types by extension:<Files *.html>

SetOutputFilter DEFLATE

</Files>

 

Simple! Enjoy your extra site speed.