All Collections
Getting Started
Making Website Faster
How to Enable 'Ignore Query String' for Varnish Cache
How to Enable 'Ignore Query String' for Varnish Cache
Emmad avatar
Written by Emmad
Updated over a week ago

Table of Contents

In the world of web hosting and performance optimization, even minor details can significantly impact your website's speed and responsiveness. One such detail is the handling of social media query strings in web requests.

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 delve 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.

Here are the following 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]+

Important

It's important to note that enabling "Ignore Query String" may affect your website tracking mechanisms, particularly third-party tracking and analytics systems. This feature is primarily designed for scenarios where precise tracking of social media query parameters is not crucial.

Suppose your marketing and advertising strategies heavily rely on such analytics. In that case, you may consider alternative solutions like WP Rocket (for WordPress), which allow you to configure parameter exclusions directly within their plugin settings instead of removing them altogether.

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. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.

Did this answer your question?