• Resolved highvoltage90

    (@highvoltage90)


    Hello,

    Thank you for sharing this plugin.

    I am doing a benchmark with Chrome’s Lighthouse tool and getting slower performance for mobile.
    First Contentful Paint Takes 2.5 sec on mobile vs 0.7 sec on desktop.
    It also shows me this warning:

    The page may not be loading as expected because your test URL (https://domain.com/) was redirected to https://domain.com/?scfm-mobile=1. Try testing the second URL directly.

    Is this slowdown expected or something wrong with my setup (or maybe just lighthouse related?).
    I am curious if mobile users will go through this.

    Let me know and thanks in advance 🙂
    – Adnan

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jose

    (@giuse)

    Hi Adnan,

    redirection is done in the .htaccess file before the PHP parsing starts. It requires practically zero effort and usually has no impact on performance. Have you seen the time needed for the redirection?
    Theoretically, it should be zero.
    That redirection is to avoid caching issues for people who don’t understand they have to use a caching system that serves a different cache for mobile devices.

    If you are sure your caching system doesn’t serve the same cache to both mobile and desktop devices, you can remove that redirection by doing so:

    • Add this line of code in the functions.php of your child theme or a functional plugin:
      add_filter( ‘scfm_add_mobile_query_string’, ‘__return_false’ );
    • Visit the backend page Settings => Permalinks

    In any case, are you sure the performance loss is caused by that redirection? Have you disabled SCFM and checked the performance on mobile?
    Are you sure your caching system caches the URLs with query strings? Maybe you have performance loss because URLs with query strings are not cached. Check your caching system, and ask to cache this kind of URLs.

    I hope it helps,

    best regards

    Jose

    @highvoltage90

    Thread Starter highvoltage90

    (@highvoltage90)

    Thank you Jose for your reply.

    If you say redirection shouldn’t be responsible for this, then it must be something wrong with my step.
    Thank you for the pointers you shared, I will check my end and let you know.

    Best,
    Adnan

    Thread Starter highvoltage90

    (@highvoltage90)

    Just circling back to confirm the slowdown is not caused by the plugin. Sorry for my misunderstanding.
    I believe the issue is resolved. lmk if I am supposed to close/delete this ticket.

    As a side question, i experimented a bit with what you mentioned. I tried to turn off browser-specific caching to check if the mobile-query-string will solve the version mismatch problem. But it didn’t.
    So now I have both the redirection, and the browser-specific caching enabled, which gives me the correct behaviour.
    Let me know if I have any redundancy.

    And btw, thank you for this plugin
    Adnan

    Plugin Author Jose

    (@giuse)

    Hi Adnan,

    thank you for the confirmation.

    If you need browser-specific caching, it means your server-side caching system ignores query strings in URLs. In other words, the server treats https://sampleurl.com and https://sampleurl.com?scfm-mobile=1 as the same, caching them identically.

    Normally, server-side caching respects query strings or lets you configure how they’re handled. However, it looks like you don’t have that option.

    So, it’s best to keep browser-specific caching enabled. You can disable the redirection if you prefer, just follow the suggestions in my previous comment, but performance-wise, it won’t make much of a difference.

    If now it works, and it’s confirmed the redirection is not giving performance issues, I would keep it like it is now.

    I will close this thread, but if you have other questions you can still reply, and also to open it again if needed.

    Have a great day!
    Jose


    Thread Starter highvoltage90

    (@highvoltage90)

    Ok that makes sense. Thank you for the explanation.

    Best,
    Adnan

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.