Title: Ignore Query String
Last modified: February 7, 2021

---

# Ignore Query String

 *  Resolved [Zoltan Baffy](https://wordpress.org/support/users/macika/)
 * (@macika)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/ignore-query-string/)
 * How can I achieve “Ignore Query String” like some CDNs do?
 * Whether the url is
 *     ```
       https://www.example.com/cars
       https://www.example.com/cars?=123
       https://www.example.com/cars?data=123
       https://www.example.com/cars?selection=abc
       ```
   
 * W3TC should only cache `https://www.example.com/cars`.
    Now if I open `https://
   www.example.com/cars?=123` then W3TC doesn’t cache the `cars` page. It should,
   no matter if _“Cache URIs with query string variables”_ is turned off, since 
   I don’t want hundreds of cached occurances of the same cars page.
 * As I remember it worked in 0.9.5.4! Somehow it was revised in later versions.
    -  This topic was modified 5 years, 3 months ago by [Zoltan Baffy](https://wordpress.org/support/users/macika/).
    -  This topic was modified 5 years, 3 months ago by [Zoltan Baffy](https://wordpress.org/support/users/macika/).
    -  This topic was modified 5 years, 3 months ago by [Zoltan Baffy](https://wordpress.org/support/users/macika/).
    -  This topic was modified 5 years, 3 months ago by [Zoltan Baffy](https://wordpress.org/support/users/macika/).
    -  This topic was modified 5 years, 3 months ago by [Zoltan Baffy](https://wordpress.org/support/users/macika/).
    -  This topic was modified 5 years, 3 months ago by [Zoltan Baffy](https://wordpress.org/support/users/macika/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Zoltan Baffy](https://wordpress.org/support/users/macika/)
 * (@macika)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/ignore-query-string/#post-14016076)
 * Solved!
 * In `w3-total-cache\PgCache_ContentGrabber.php`:
 *     ```
       		 * Skip if there is query in the request uri
       		 */
       		$this->_preprocess_request_uri();
   
       		if ( !empty( $this->_request_url_fragments['querystring'] ) ) {
       			$should_reject_qs =
       				( !$this->_config->get_boolean( 'pgcache.cache.query' ) ||
       				$this->_config->get_string( 'pgcache.engine' ) == 'file_generic' );
   
       			if ( $should_reject_qs &&
       				$this->_config->get_string( 'pgcache.rest' ) == 'cache' &&
       				Util_Environment::is_rest_request( $this->_request_uri ) ) {
       				$should_reject_qs = false;
       			}
   
       			if ( $should_reject_qs ) {
       				$this->cache_reject_reason = 'Requested URI contains query';
       				$this->process_status = 'miss_query_string';
   
       				return false;
       			}
       		}
       ```
   
 * I just delete everything in this, it was the easiest method to eliminate it without
   an error.
 * Kept just this:
 *     ```
       		/**
       		 * Skip if there is query in the request uri
       		 */
       		$this->_preprocess_request_uri();
   
       		if ( !empty( $this->_request_url_fragments['querystring'] ) ) {
   
       		}
       ```
   
 * Not an elegant and correct method, but it works!
 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/ignore-query-string/#post-14016928)
 * Hello [@macika](https://wordpress.org/support/users/macika/)
 * Thank you for providing the solution.
    As this works in your case, it might not
   work in different setups so we will make sure to check and test this to see if
   it may cause any issues. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Ignore Query String’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/ignore-query-string/#post-14016928)
 * Status: resolved