How to cache a URL with a query string
At times, you might have noticed that certain URLs containing query strings (the part of a URL after a ? character) don’t seem to be cached. For instance, a URL might look like:
https://example.com/?action=example
Let’s delve into why this happens and how you can resolve it.
Understanding the Query String Caching Issue
Many caching systems, both server-side and WordPress caching plugins, will interpret URLs with query strings as dynamic. This is due to the fact that the main goal of caching is to store a static copy of your webpage, which accelerates site loading times and alleviates server strain.
However, when a URL contains a query string, it often signifies that the page should display variable content based on the parameters within that query string. Consequently, to ensure users receive the correct, unique version of a page tailored to their specific query parameters, caching systems traditionally see such URLs as requiring dynamic content.
Solution: Setting Ignorable Query Strings
If you are confident that the content for these URLs with query strings remains consistent, you can instruct Staq to ignore the query strings for caching purposes. Here’s how you can achieve this:
- Inside the WordPress site, click Staq Hosting plugin and inside Options, set the URL inside Set ignorable query strings:

- Save your changes.
Note: These query strings will be disregarded on the WordPress level and served via advanced-cache.php. However, it’s important to understand that they won’t be ignored at the Nginx level.
How to know when a page is cached
To understand if a page is cached, this is the KB on how to see if a WordPress page is cached.
In Conclusion
While caching systems usually treat URLs with query strings as dynamic to serve the most accurate content, you have the flexibility with Staq to specify which query strings should be ignored for caching. This is especially useful for query strings that don’t alter the content of the page.
Should you have further questions or encounter any issues, feel free to reach out to our support team. We’re here to help!
Need some help?
We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.