Don’t hate the query string

Lately, we feel there’s been a lot of chatter about the negative effects of query strings and WordPress with headlines like “WordPress query strings and how to remove them”.

We are here to say they’re not all that bad and may not matter at all.

So, what’s a query string?

Query strings are the bits of code added to the end of a URL such as example.com/?color=red.

While they may be essential to how your WordPress site works and filters content, there are other query strings that don’t seem helpful at all. For instance, example.com/style.css?ver=1.0. This is a query string for a static asset and these are the questionable ones we’re talking about.

By default, WordPress themes and Core itself ships with static assets using query strings. These include CSS and JavaScript files and the general consensus is that query strings prevent most hosting environments and browsers to cache that asset so it lowers overall site performance.

While there is some truth to this, it really depends on your hosting environment.

Query Strings on Shifter

At Shifter, we don’t mind query strings. Shifter is able to cache query strings for static assets with no additional config necessary. Once you create a static version of your WordPress site using our static site generator those CSS, JS files, and with their query strings are cached with our CDN.

We built Shifter using Amazon CloudFront and their CloudFront Edge Locations. As an Amazon Advanced Technology Partner, we wanted to bridge the gap between what Amazon has to offer and where WordPress needs the most help.

According to the AWS docs, CloudFront covers “a global network of 116 Points of Presence (105 Edge Locations and 11 Regional Edge Caches) in 56 cities across 24 countries”. That’s a lot of coverage.

Not only are the static assets in your WordPress sites cached regardless of query strings they are also served locally to the user from the nearest edge location!

Quick fix isn’t a solution

Rather than removing query strings to accommodate features that your hosting environment lacks, keep them and migrate to one that does. You shouldn’t have to modify your site to make up features that should be supported and work great with WordPress.

This extends not only to performance but to security as well. Securing WordPress is difficult but there should be a layer of protection sitting well above the site itself. Shifter offers that too by serving static files and running WordPress is a secure environment away from bots or malicious attacks.

Let us know what you think and get started with a free trial of Shifter today.