Skip to main content

How to Enable 'Ignore Query String' for Varnish Cache

Learn how to enable Ignore Query String in Varnish on Cloudways to boost cache efficiency, speed up sites, and handle tracking parameters.

Written by Syed Abuzar Mehdi
Updated over 7 months ago

Even the smallest details in website optimization can affect how fast your pages load. One such detail is the handling of query strings—extra parameters added to URLs by platforms like Facebook, Google Ads, or email campaigns.

By default, Varnish treats each unique query string as a separate cacheable resource, which can lead to cache fragmentation and slower response times.

Cloudways solves this with the Ignore Query String feature in the New Interface. When enabled, Varnish bypasses unnecessary tracking parameters (such as fbclid, gclid, or utm_*) and serves a single cached version of your page, ensuring faster, more consistent performance for your visitors.

Tip:

Look out for one of the best Hostgator alternative.


Table of Contents:


Understanding the Ignore Query String Feature in Cloudways

Cloudways offers an "Ignore Query String" feature that significantly enhances your website's performance.

In this article, we will dive deep into query strings, how they affect your website's caching and loading times, and how you can use the "Ignore Query String" feature to optimize your site's performance.

Important:

The "Ignore Query String" feature discussed in this article is only available on Cloudways New Interface and applicable for social media query strings. It works only if you have Varnish enabled on your server and application. Please ensure Varnish is active before enabling this feature to optimize your website's performance effectively.

What are Query Strings

Before we dive into the nitty-gritty of query strings and their impact, let's understand what they are. In web URLs, query strings are parameters or additional information appended after a question mark (?). For example, consider this URL:

https://www.example.com/page?utm_source=google&utm_medium=cpc 

In this URL, the query string is utm_source=google&utm_medium=cpc, and it contains information about the source and medium of the website traffic.

By default, Varnish and Nginx treat URLs with query strings as distinct resources.

This means that if a URL has a different query string, even if it leads to the same page, it will be treated as a separate cached resource.

This behavior can lead to suboptimal performance in some cases.

How Does Ignore Query String Work?

Cloudways introduces the "Ignore Query String" feature, designed to optimize your website's performance by treating URLs with query strings more efficiently.

When "Ignore Query String" is disabled (default behavior), each unique query string is treated as a separate cacheable resource. Let's consider an example:

Suppose you share your website URL on social media platforms, and each click adds a unique query string like ?fbclid=xyz, where xyz is a random string.

With the feature disabled, each user who clicks your URL will receive a non-cached page because the query string is treated as part of the URL, leading to slower loading times.

Enabling the "Ignore Query String" feature changes the game. With this feature active, all visitors to your website, regardless of the query string, will receive the same cached version of your page.

This ensures consistent and fast page loading times, even when social media platforms add unique query strings.

Following are the query strings where this feature works:

Query Strings

msclkid

gclid

dm_i

qid

mc_eid

mc_cid

fbclid

cx

ie

cof

siteurl

zanpid

origin

utm_[a-z]+

mr:[A-z]+

Note:

Enabling Ignore Query String may affect third-party tracking and analytics. Use it when precise tracking of social or marketing parameters isn’t critical. If your campaigns rely on these parameters, consider alternatives like WP Rocket (for WordPress), which lets you exclude parameters without removing them entirely.

How to Enable "Ignore Query String" for Varnish Cache?

Here's how you can enable "Ignore Query String" on Cloudways, which is very straightforward.

Log in to your Cloudways Platform using your credentials.

  1. From the top menu bar, open Servers.

  2. Then, choose the server where your desired application is deployed.

  3. Next, click www.

  4. Choose your application.

  5. Under Application Management, select Application Settings.

  6. Navigate to the General tab.

  7. Enable Ignore Query String.

  8. You will be prompted to confirm this selection; thus, click Confirm to enable the Ignore Query String feature.

Optimizing your website's performance is a top priority; every slight improvement can make a significant difference.

The "Ignore Query String" feature from Cloudways is a powerful tool that helps ensure consistent and fast loading times for your visitors, even when query strings are present.

By understanding how this feature works and when to use it, you can enhance the user experience on your website and keep your audience engaged.


That’s it! We hope this article was helpful.

Need Help?

If you need assistance, feel free to:

We're here 24/7 to help you!

Did this answer your question?