• Resolved raymond621

    (@raymond621)


    Hi Support

    I am using this plugin called CURCY that allows my shop to switch currency using javascript. The product’s URL remains the same regardless which currency I use. Under Chrome inspection, I can see the product is showing a “Hit” status for page cache, when I switch to another currency, it is showing as “missing”?

    The URL is the same, so why is the latter not cached?

    Here is a sample product:

    https://www.marsnvenus.com/shop/sample-product-a-copy/

Viewing 9 replies - 16 through 24 (of 24 total)
  • Thread Starter raymond621

    (@raymond621)

    it turns out that none of the pages with query string is being cached even after completing the crawling.

    /?wmc-currency=AUD

    /?wmc-currency=USD

    /?wmc-currency=CAD

    /?wmc-currency=GBP

    /?wmc-currency=NZD

    I thought after adding the cookie simulation, it would be crawled and cached. I ahve google shopping feeds set up with query string so customers from different countries will be directed to the right product page, displaying the correct currency. Is this the normal behavior and how do I make sure the appended query string is cache when it warms up from the crawling?

    Thread Starter raymond621

    (@raymond621)

    And I don’t think the codes provided earlier works. Even after crawling the entire site, when I checked on the product link without the query string, it is not being cached. Would you like to take a look at my homepage or product pages? Only the default currency USD is being cached.

    Thread Starter raymond621

    (@raymond621)

    Why does it cost 404 error when I access to alll pages with this code. Only the homepage works fine. I already added the code at the very top of htacess.


    <IfModule Litespeed>
    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = USD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+usd]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = GBP [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+gbp]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = AUD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+aud]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = CAD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+cad]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = NZD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+nzd]
    </IfModule>

    # BEGIN LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule litespeed/debug/.*\.log$ - [F,L]
    RewriteRule \.litespeed_conf\.dat - [F,L]

    ### marker ASYNC start ###
    RewriteCond %{REQUEST_URI} /wp-admin/admin-ajax\.php
    RewriteCond %{QUERY_STRING} action=async_litespeed
    RewriteRule .* - [E=noabort:1]
    ### marker ASYNC end ###

    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###

    ### marker LOGIN COOKIE start ###
    RewriteRule .? - [E="Cache-Vary:,wp-postpass_2cdc91481948393ac7cf30292d6e21d2,wmc_current_currency,wmc_current_currency_old,wmc_ip_info"]
    ### marker LOGIN COOKIE end ###

    ### marker DROPQS start ###
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    CacheKeyModify -qs:attribute_pa_size
    CacheKeyModify -qs:attribute_pa_color
    ### marker DROPQS end ###

    </IfModule>
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END LSCACHE
    # BEGIN NON_LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    ### marker BROWSER CACHE start ###
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType application/pdf A3888000
    ExpiresByType image/x-icon A3888000
    ExpiresByType image/vnd.microsoft.icon A3888000
    ExpiresByType image/svg+xml A3888000

    ExpiresByType image/jpg A3888000
    ExpiresByType image/jpeg A3888000
    ExpiresByType image/png A3888000
    ExpiresByType image/gif A3888000
    ExpiresByType image/webp A3888000

    ExpiresByType video/ogg A3888000
    ExpiresByType audio/ogg A3888000
    ExpiresByType video/mp4 A3888000
    ExpiresByType video/webm A3888000

    ExpiresByType text/css A3888000
    ExpiresByType text/javascript A3888000
    ExpiresByType application/javascript A3888000
    ExpiresByType application/x-javascript A3888000

    ExpiresByType application/x-font-ttf A3888000
    ExpiresByType application/x-font-woff A3888000
    ExpiresByType application/font-woff A3888000
    ExpiresByType application/font-woff2 A3888000
    ExpiresByType application/vnd.ms-fontobject A3888000
    ExpiresByType font/ttf A3888000
    ExpiresByType font/otf A3888000
    ExpiresByType font/woff A3888000
    ExpiresByType font/woff2 A3888000

    </IfModule>
    ### marker BROWSER CACHE end ###

    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END NON_LSCACHE

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress
    Plugin Support qtwrk

    (@qtwrk)

    this code itself won’t alter any permalink , you can try flush the permalink again , see how it goes

    and also , if your currency works without this , then you don’t really need to put it in.

    Thread Starter raymond621

    (@raymond621)

    But adding the code just like how I did definitely broke the site and returned a 404 error for all pages except the homepage. I cant seem to get this to work and the plugin provider asked me to contact lightspeed cache for support.

    I also added cookie simulation for wmc-currency with value AUD.

    When I go to the product page (https://www.mylovehoney.com/shop/sunflower-print-enjoy-the-little-things-onesie-short-sleeve-denim-tiered-bloomers-with-headband/?wmc-currency=AUD), its a cache miss but the cookies are there. Press F5, cache hits. Exit the browser and open the above link, it becomes a cache miss again. What seems to be wrong?

    Plugin Support qtwrk

    (@qtwrk)

    I don’t think this rewrite rule will break page rewrite

    please create a ticket by mail to support at litespeedtech.com , we will investigate further.

    Thread Starter raymond621

    (@raymond621)

    Do I email support to here?

    [email protected]

    Thread Starter raymond621

    (@raymond621)

    I another site from the same hosting company but uses shared hosting, and it works without errors with the code.

    Even If I copied the entire code from that site to my vps server from the same hosting company, it causes 404 error.

    Thread Starter raymond621

    (@raymond621)

    I altered the code slightly by removing <IfModule Litespeed> and </IfModule> and move the code all the way to the bottom after #END WordPress

    Right now there’s no more 404 errors but how do I know if the code is actually rewriting anything base on the specified rules?

    BEGIN LSCACHE LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block!


    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule litespeed/debug/.*.log$ - [F,L]
    RewriteRule .litespeed_conf.dat - [F,L] marker ASYNC start

    RewriteCond %{REQUEST_URI} /wp-admin/admin-ajax.php
    RewriteCond %{QUERY_STRING} action=async_litespeed
    RewriteRule .* - [E=noabort:1] marker ASYNC end marker CACHE RESOURCE start

    RewriteRule wp-content/./[^/](responsive|css|js|dynamic|loader|fonts).php - [E=cache-control:max-age=3600] marker CACHE RESOURCE end marker LOGIN COOKIE start

    RewriteRule .? - [E="Cache-Vary:,wp-postpass_2cdc91481948393ac7cf30292d6e21d2,wmc_current_currency,wmc_current_currency_old,wmc_ip_info"] marker LOGIN COOKIE end marker DROPQS start

    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    CacheKeyModify -qs:attribute_pa_size
    CacheKeyModify -qs:attribute_pa_color marker DROPQS end LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! END LSCACHE BEGIN NON_LSCACHE LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! marker BROWSER CACHE start


    ExpiresActive on
    ExpiresByType application/pdf A3888000
    ExpiresByType image/x-icon A3888000
    ExpiresByType image/vnd.microsoft.icon A3888000
    ExpiresByType image/svg+xml A3888000

    ExpiresByType image/jpg A3888000
    ExpiresByType image/jpeg A3888000
    ExpiresByType image/png A3888000
    ExpiresByType image/gif A3888000
    ExpiresByType image/webp A3888000

    ExpiresByType video/ogg A3888000
    ExpiresByType audio/ogg A3888000
    ExpiresByType video/mp4 A3888000
    ExpiresByType video/webm A3888000

    ExpiresByType text/css A3888000
    ExpiresByType text/javascript A3888000
    ExpiresByType application/javascript A3888000
    ExpiresByType application/x-javascript A3888000

    ExpiresByType application/x-font-ttf A3888000
    ExpiresByType application/x-font-woff A3888000
    ExpiresByType application/font-woff A3888000
    ExpiresByType application/font-woff2 A3888000
    ExpiresByType application/vnd.ms-fontobject A3888000
    ExpiresByType font/ttf A3888000
    ExpiresByType font/otf A3888000
    ExpiresByType font/woff A3888000
    ExpiresByType font/woff2 A3888000 marker BROWSER CACHE end LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! END NON_LSCACHE BEGIN WordPress The directives (lines) between "BEGIN WordPress" and "END WordPress" are dynamically generated, and should only be modified via WordPress filters. Any changes to the directives between these markers will be overwritten.

    RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] END WordPress LITESPEED WP CACHE FOR WMC CURRENCY CUSTOM START

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = USD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+usd]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = GBP [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+gbp]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = AUD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+aud]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = CAD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+cad]

    RewriteCond %{HTTP_COOKIE} ^wmc_current_currency$ = NZD [NC]
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+nzd] LITESPEED WP CACHE FOR WMC CURRENCY CUSTOM END

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘cache query string’ is closed to new replies.