• Resolved wtvxy

    (@wtvxy)


    Of course, sometimes there are unique id for DOMs. But think all woocommerce products page will share almost same CSS. Is it neccessary generate it for each product page?

    Plus, I have set up the lazy load image exclude for my first image but PSI still says Largest Contentful Paint is lazy-loaded.
    You can check my setting here:
    https://ibb.co/PDHsb5B
    https://ibb.co/yWv8h4y

    Report number: VKRTCRGK

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter wtvxy

    (@wtvxy)

    One more question:
    I set 2 vary caches for CN and Other in .heaccess, respectively.

    RewriteEngine on
    RewriteRule .* – [E=Cache-Control:vary=other]
    #set default vary to other
    RewriteCond %{HTTP:x-qc-country} CN
    RewriteRule .* – [E=Cache-Control:vary=CN]

    In fact, I only need to vary cache for my homepage to redirect. Which I only need to create one more cache instead of create CN cache for every page (which uses up my quato everyday). Could you tell me how to set up it?

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    when it comes to UCSS, where U stands for Unique , so yes , at current structure , it is one per page , even though if they are pretty much similar

    where did it say that ?

    for second question , you can add another check , make it like

    if page URL is / , and qc country header is CN , then vary

    best regards,

    Thread Starter wtvxy

    (@wtvxy)

    OK. Please treat the first question as a request.

    For second one, I found it’s because WP 5.5 build-in lazy-load. I disable that and the PSI does not notice me about that again.

    For third one. I annotate the vary cache codes and superisely find that my ip-based redirect plugin still works when I switch visiting from CN and Other countries. Maybe litespeed does not cache the HTTP_X_CLIENT_IP hearder so that plugin can get correct ip each time?

    Plugin Support qtwrk

    (@qtwrk)

    not sure about your redirection case

    bottom line is , you need to trigger the PHP to geoip it

    Thread Starter wtvxy

    (@wtvxy)

    I use IP2Location Redirection plugin and I have checked there php code. They use $_SERVER[‘REMOTE_ADDR’] or $_SERVER[‘HTTP_X_FORWARDED_FOR’] to get the geo ip.
    I will keep testing if my case will still work without vary cache.

    Plugin Support qtwrk

    (@qtwrk)

    no no , I mean like this

    I live in country A , you live in country B

    I access the page , the page is generated and cached where it shows me in country A

    then you visit it , despite you from B , it will still show A because it is cached already and won’t trigger PHP to regenerate , that’s where you need to have a vary to trigger the PHP again

    Thread Starter wtvxy

    (@wtvxy)

    Yes. I understand what you mean. But the redirection still works for my website without vary cache. That’s why I say it superises me.

    You can test this link theryang.com if you have CN proxy

    If visitor is from CN, it will be redirected to /collection/ instead of home page.
    As I tested, it works everytime even though I switch my vpn to CN/non-CN each visiting.

    • This reply was modified 3 years, 2 months ago by wtvxy.
    Plugin Support qtwrk

    (@qtwrk)

    well , sadly I don’t have proxy there …

    Thread Starter wtvxy

    (@wtvxy)

    OK. I will continue testing this in the future and discuss with you if it failed someday.

    Thread Starter wtvxy

    (@wtvxy)

    Well. It does not work now…..
    I think I still need to set up.
    How should I write this logical

    if page URL is / , and qc country header is CN , then vary
    otherwise other

    in .htaccess?

    If I only want to redirect my homepage to https://www.theryang.com/collection/.
    Do you think follow codes is a better way?

    RewriteEngine on
    RewriteCond %{HTTP:x-qc-country} CN
    RewriteCond %{HTTP_HOST} ^(?:www\.)?theryang\.com$ [NC] 
    RewriteRule ^/?$ https://www.theryang.com/collection/ [R=301,L]

    In this way, I do not need to care about the vary cache and use Geoip plugin.

    • This reply was modified 3 years, 2 months ago by Yui.
    • This reply was modified 3 years, 2 months ago by wtvxy.
    Thread Starter wtvxy

    (@wtvxy)

    maybe this enough?

    RewriteCond %{HTTP:x-qc-country} CN
    RewriteRule ^/?$ https://www.theryang.com/collection/ [R=301,L]
    Plugin Support qtwrk

    (@qtwrk)

    rewrite rule is not exactly my best friend … but it looks fine to me

    if you have server access, you can check the rewrite log , to see how exactly it was interpreted

    best regards,

    Thread Starter wtvxy

    (@wtvxy)

    I do not what happen.
    It redirect every country to /collection now, even I purge litespeed and cdn cache,

    Thread Starter wtvxy

    (@wtvxy)

    It seems as long as I visit from CN, my browsers cache it and redirect everytime even I switch back to SG. After clean the cache manually, it doesn’t redirect me from SG.

    Thread Starter wtvxy

    (@wtvxy)

    Ok. I change R=302 since 302 does not cache.
    Everythink works fine now .

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to avoid duplicating UCSS for each product pages’ is closed to new replies.