• Resolved invictumhr

    (@invictumhr)


    Hello,

    We have custom plugin which redirects VPN ips to some custom url. Example if our domain is example.com and some user open https://www.example.com he should remain on this url. But if user with ip xxx.xxx.xxx.xxx types https://www.example.com then user should be redirected to https://www.example.com/?vpn=1.

    We have plugin which manages redirects and it is working fine. But if we activete LSCWP then redirects do not works.

    Can we in our custom plugin write code that will execute even if page is cached with LSCWP ?

    Our custom plugin has add_action(‘wp’, ‘our_function_name’), and function our_function_name reads user IP, then checks is this IP in mysql database table with defined IPS, and if it is in this table then we redirect to {current_url} + “?|&” + “vpn=1”

    Thank you and best regards,
    Ivan

    • This topic was modified 5 years, 6 months ago by invictumhr.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Is it possible you can insert a cookie from your function ?

    once there is a cookie , we can use it for vary

    like if you can set a cookie like

    use_vpn = y

    use_vpn = n

    then when request come with different cookie value , same page will get different result.

    Best regards,

    Thread Starter invictumhr

    (@invictumhr)

    Hello,

    Yes, i can set cookie. Ok, i will try to set a cookie. And i will contact you back with results 🙂

    Do i need to setup this new cookie in LSWPC plugin?

    Or is there hook that is fired even if page is cached, so i can with my plugin integrate this hook?

    Thank you

    • This reply was modified 5 years, 6 months ago by invictumhr.
    Thread Starter invictumhr

    (@invictumhr)

    Hello,

    If i set cookie vpn=no, only first user after purging have this cookie. When i load page with another browser then in new browser there is no this cookie.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    yeah … that was half way

    if you can set cookie , then add this into top of your .htaccess

    RewriteRule .* – [E=Cache-Vary:vpn]

    purge all and try again.

    Best regards,

    Thread Starter invictumhr

    (@invictumhr)

    Hello @qtwrk ,

    It is working now. Thank you very much for your help 😉

    Best regards,
    Ivan

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom Plugin fail to redirect’ is closed to new replies.