fdmind/ignore-query-strings

If your website has static caching on, and you drive traffic to it from social media, Google Ads and other sources that add query string parameters to the URL, there is a chance that each time new user visits a page, it will not be served from cache, but will be generated from scratch. This is becau

v2.0.1 2024-06-06 21:37 UTC

This package is not auto-updated.

Last update: 2024-10-24 23:23:11 UTC


README

If your website has static caching on, and you drive traffic to it from social media, Google Ads and other sources that add query string parameters to the URL, there is a chance that each time new user visits a page, it will not be served from cache, but will be generated from scratch. This is because the URL with query string parameters is treated as a different URL from the one without query string parameters.

You could always set 'ignore_query_strings' => true, but that would mean that you would not be able to use query string parameters in your templates.

This addon allows to have both: ignore query string parameters for caching purposes, but still be able to use them in your templates.

DISCLAIMER: Addon will not work if you have full static caching on and Nginx rules set up to serve static html files directly.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require fdmind/ignore-query-strings

How to Use

Addon comes with ignore-query-strings.php config file, where you can specify which query string parameters Statamic should allow or deny. By default, it is set to allow only most popular parameters, but you can remove and add your own.