• Resolved Al

    (@asierrajr)


    I have been testing gtranslate plugin for site translation and I am running into an issue with caching content where there are query string parameters present in the url in the original language only. ( I am using a path approach for content translation eg: domain.com/es for spanish)

    In the inc/cache.php file in your plugin, there is a code snippet specifically for the gtranslate plugin( line 92) where it first checks if its activated

    If it is, it first checks if there is a cache file with the language code and the REQUEST_URI , if not it checks REDIRECT_URL and If not it checks REQUEST_URI.

    The problem is that in the original language, it will bypass the first check since the language code is not present and then in the REDIRECT_URL check, it passes, since it will only contain the path but no querystring parameters and this is the cache file that gets loaded up. So any querystring url will just load from that REDIRECT_URL cache file name.
    Ex: domain.com/hello-world/ cache file will load the same for domain.com/hello-world/?page=1

    If the REDIRECT_URL check is necessary, you may need to also include the REDIRECT_QUERY_STRING as part of the cache filename if WPFC_CACHE_QUERYSTRING is set to true, that way it can uniquely cache paths with querystring

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Emre Vona

    (@emrevona)

    Did it cause any problems?

    Thread Starter Al

    (@asierrajr)

    Yes it does.

    If you have gtranslate enabled and let say you have a url with the following:
    domain.com/hello-world/?category_id=1

    On first hit, the plugin will cache the contents of domain.com/hello-world/?category_id=1 in ../cache/domain.com/all/hello-world/index.html

    On second hit, if you go to let say domain.com/hello-world/?category_id=2, it will continue to load the contents from ../cache/domain.com/all/hello-world/index.html ( which is not correct since it’s the cached content of domain.com/hello-world/?category_id=1 )

    I reviewed the code snippet I mentioned above in your plugin, REDIRECT_URL will only contain hello-world and the code snippet ignores the query string parameter which is stored in REDIRECT_QUERY_STRING.

    Plugin Author Emre Vona

    (@emrevona)

    can you contact me via email please: https://www.wpfastestcache.com/contact-us/

    Thread Starter Al

    (@asierrajr)

    Thanks for the response and working this issue out together.
    Fix was committed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘gTranslate and caching file issue’ is closed to new replies.