Forums

W3 Total Cache
[resolved] varying query string variables wildcard (9 posts)

  1. savvyharry
    Member
    Posted 1 year ago #

    hi support,

    I am using w3 total cache and i am interested in serving cached pages to urls with varying query string variables.

    here is what i mean:

    page to cache:
    http://www.domain.com/page1/

    can the above cached page be served to:
    http://www.domain.com/page1/?date-time-unique-identifier1
    http://www.domain.com/page1/?date-time-unique-identifier15
    http://www.domain.com/page1/?date-time-unique-identifier16
    http://www.domain.com/page1/?date-time-unique-identifier155
    http://www.domain.com/page1/?date-time-unique-identifier1877
    http://www.domain.com/page1/?date-time-unique-identifier1411
    http://www.domain.com/page1/?date-time-unique-identifier18383452
    http://www.domain.com/page1/?date-time-unique-identifier1555

    Is there currently an option to do this?

    I am not interested in Caching URIs with query string variables, because my query string variables will CHANGE for every visitor... so there is no point to cache each page relative to each string.

    Can I simply serve them the same cached page regardless of what the trailing query string variables are? Something like a wildcard function?

    Thank you very much!

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. savvyharry
    Member
    Posted 1 year ago #

    sorry, forgot to mention...

    should matter but I would like to do this for "Page caching via memcached"

  3. marcuslayton
    Member
    Posted 1 year ago #

    we are also looking for this functionality - let me know what you have figured out

  4. marcuslayton
    Member
    Posted 1 year ago #

    we ended up modifying the lib\w3\PgCache.php file - right at the top of the file

    function _get_page_key($request_uri, $mobile_group = '', $referrer_group = '',
            $encryption = false, $compression = false, $content_type = false) {
            // replace fragment
            $key = preg_replace('~#.*$~', '', $request_uri);
    
    // WE ADDED THIS
    // replace query string
    $key = preg_replace('~\?.*$~', '', $key);

    obviously it we'll have to do it every update - and your implementation is a touch different

    would be nice to get that added in as a feature

  5. savvyharry
    Member
    Posted 1 year ago #

    hi marcuslayton,

    it seems you have got it working :) so the final mod looks like version 1 below?

    function _get_page_key($request_uri, $mobile_group = '', $referrer_group = '',
            $encryption = false, $compression = false, $content_type = false) {
    
            $key = preg_replace('~\?.*$~', '', $key);

    or would it look like verision 2 below?

    function _get_page_key($request_uri, $mobile_group = '', $referrer_group = '',
            $encryption = false, $compression = false, $content_type = false) {
    
            $key = preg_replace('~#.*$~', '', $request_uri);
            $key = preg_replace('~\?.*$~', '', $key);

    1) with your modification, does this REMOVE the query string entirely?

    2) or does it simply ignore the query string now and serve the cached page regardless?

    3)

    implementation is a touch
    if you don't mind me asking, how are you guys using it? can you give some suggestion so that it would work for my purpose as well?

    thanks for your help!

  6. cyonite
    Member
    Posted 1 year ago #

    Its currently not possible. But its version 2 they are using.
    And it removes the query for all modes not just disc enchanced.

  7. marcuslayton
    Member
    Posted 1 year ago #

    thanks andreas - i missed responding to this

  8. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    There will be hooks available for addressing cases like this in the next release.

  9. marcuslayton
    Member
    Posted 1 year ago #

    ahh - excellent - thanks frederick! dang love the plugin

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic