WordPress.org

Forums

WP Super Cache
Configure WP Super Cache to Forward Url Parameters to Existing Cached Page (6 posts)

  1. optimized-marketing
    Member
    Posted 1 year ago #

    I am using WP Super Cache in mod_rewrite mode. I see there is an option to either ignore Get Parameter (ex. ?parm=test) or have them cached as their own page.

    I have a bunch of pages that use GET parameters for JavaScript purposes. Things from Google Analytics Tracking Parameters to Google Content Experiment Parameters to Parameters which are used to show a different Phone Number based on the value. They are all Javascript based so they should not be part of the original caching of the page.

    Is there a way to pass the parameter to an existing cached file?

    For example:
    There is a cached page for myhomepage.com.
    Someone goes to myhomepage.com/?name=bob
    It loads the originally cached page for myhomepage.com and includes the ?name=bob to the page when it loads?
    So the page still loads the original cached file but the parameters can be used to display the page and forwarded to 3rd party systems that are JS based.

    I am not totally sure but I believe there might be a way to do this with mod_rewrite in the .htaccess file but I am not sure if there are any plug-in specifics that need to be set or configured. Or which part of the htaccess mod_rewrite code that wp super cache provides needs to be reworked.

    This will help decrease the number of cached pages on the server and help with the handling of GET Parameters in WP Super Cache.

    Thanks
    Greg

    http://wordpress.org/plugins/wp-super-cache/

  2. optimized-marketing
    Member
    Posted 1 year ago #

    I noticed this topic has been brought up a few times and the only real solutions I see are from this two thread:

    http://wordpress.org/support/topic/plugin-wp-super-cache-cache-requests-with-query-string-_get-parameters?replies=17

    They update the plug-in to achieve what I am asking about, but it is for an older version of the plugin. Is there a reason this hasnt been added to the plugin?

    I also on http://wordpress.org/support/topic/plugin-wp-super-cache-google-adwords-gclid-parameter-conflicting-with-caching

    The author of the said an parameter ignore list would be helpful, but didn't promise anything. Is there any update on this feature? Is it in the works still?

    If these two features could be combined, so you could make a list of GET parameters that are ignored during the Super Caching process but are included in the final url of the page. That would be the perfect compromise. Since the parameters (ones added to the ignore list) used by JS will load the supercached page but the parameters that are used by PHP will continue to act as it currently does(regular cache).

  3. optimized-marketing
    Member
    Posted 1 year ago #

    Donncha has this been added to your future features list?

  4. Donncha O Caoimh
    Member
    Plugin Author

    Posted 1 year ago #

    I'm afraid it's not high on my list of things to do, sorry.

  5. webmogul
    Member
    Posted 1 year ago #

    I am using the code from this post: http://wordpress.org/support/topic/plugin-wp-super-cache-google-adwords-gclid-parameter-conflicting-with-caching

    Problem is that by using it I loose all Google Adwords tracking.

    I could disable caching for pages with GET, but many pages make use of GET, so most traffic would not be cached.

    Donnacha, couldn't you come up with a way to pass the gclid parameter to a cached pages.

    At first, it could be something as simple as duplicating on the fly an already cached page and appending the glcid parameter. I don't know it that can be accomplished with rewrites in htaccess.

    I hate having to choose caching over tracking or vice versa.

  6. gemme
    Member
    Posted 10 months ago #

    I managed to forward pages with gclid parameter to a page ending with just "?" by adding this code to wp-cache-phase1.php:

    $wp_cache_request_uri = $_SERVER[ 'REQUEST_URI' ]; // Cache this in case any plugin modifies it.
    
    // CHANGE HERE
    $wp_cache_request_uri = preg_replace('/gclid=[\w]+&?/i', '', $wp_cache_request_uri);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic