Caching Query Strings

WP Rocket does not cache pages with query strings by default, although there are some very specific exceptions (see below). 

A query string is where you have a URL that contains a question mark followed by a parameter and a value, like this:

example.com/page/?country=italy

In this case, country is the parameter and italy is the value.

If you want these types of pages to be cached, go to the Advanced Rules settings tab, and add each parameter in the Cache Query String(s) text field (one per line):

When you do this, a dedicated cache file will be generated for each value the parameter country receives in a URL.

Special cases

Ignored query string parameters with standard caching

  • utm_source
  • utm_campaign
  • utm_medium
  • utm_expid
  • utm_term
  • utm_content
  • fb_action_ids
  • fb_action_types
  • fb_source
  • fbclid
  • _ga
  • gclid
  • age-verified
  • ao_noptimize
  • usqp
  • cn-reloaded

For all of the parameters listed above, WP Rocket will ignore the query string and serve the standard cache file, regardless of any parameter values in the URL. Here’s what that means:

example.com/about-us/?gclid=something
example.com/about-us/?gclid=somethingelse

// will BOTH receive the cache file from:
example.com/about-us/

If you would like to customize the list of of ignored parameters, please see this guide.

Please note: A dedicated cache file will be created when the parameters found in the dedicated caching section below or those placed on the Advanced Rules tab referenced above are included in the URL.

URLs with multiple parameters

A query string can also contain multiple parameter/value pairs, chained by  & characters. Example:

example.com/page/?utm_source=this&utm_campaign=that&utm_medium=theother

In cases where you have a mixture of ignored parameters (from the list above) and others not on the list, the page will not be cached. Parameters have to match the list exactly in order to be cached. 

Parameters with dedicated caching

  • lang
  • permalink_name
  • lp-variation-id

For all of the parameters listed above, WP Rocket will serve the dedicated cache file, depending on the parameter values in the URL. Here’s what that means:

example.com/about-us/?lang=english
example.com/about-us/?lang=french

// will create a dedicated cache file for their parameter/value pairs:

?lang=english
?lang=french

WooCommerce Geolocation Support

In WooCommerce there is the option to enable Geolocation (with page caching support):

Default Customer Location: Geolocate (with page caching support)

When that option is active, WooCommerce appends a query string to each URL, like this:

v=42983b05e2f2

WP Rocket automatically caches those parameters. 

Search Results (dedicated caching)

The standard parameter for WordPress search results is: s 
However, the Cache query strings option will not enable caching for this parameter. To cache search results, please install the helper plugin found here.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.