• Hello,

    First, Artem thanks for your excellent plugin.

    I have a site that redirects traffic from a region to the reseller site for that region. This works well.

    BUT I need to allow the reseller to view the original site for product training and support. I know I can ask them to manually put “?no_redirect” after the URL but this requires them to copy the URL > paste it into the address bar > manually enter ?no_redirect > then press ENTER for each web page.

    If there another easier way to let the reseller see the original site? Would it be possible to set a cookie on their machine and then use this to override the geo redirect?

    Thanks in advance for your assistance,
    Peter Evans eMarkingAssistant.com

    https://www.ads-software.com/plugins/geographical-redirect/

Viewing 4 replies - 1 through 4 (of 4 total)
  • It looks like I was able to achieve the same goal with PHP. I added this to the header.php theme file:

    if($_SERVER['REQUEST_URI']
      && strpos($_SERVER['HTTP_REFERER'],'no_redirect')!==false
      && !$_SERVER['QUERY_STRING']){
        header("Location: ".$_SERVER['REQUEST_URI'].'?no_redirect');
    }

    It’s only as reliable as the server referrer variable having information, but has worked in a pinch.

    Any other ideas or methods anyone has found to carry the ?no_redirect through? I had also tried with .htaccess rewrite rules but with no success, so am using this PHP redirect method for now.

    Best wishes.

    A follow up – this also required this setting in the plugin to be checked:
    ‘Redirect only visitors of the site’s root’

    Thread Starter evanspj

    (@evanspj)

    Hello RedEarthDesign,

    thanks for replying and your work around looks like it might allow my reseller to access the original site. I have added the code to header.php and it does what you suggest and it keeps the ?no_redirect when browsing through the original site. but I am not quite sure why if I go back to the landing page for the site why I am redirected to the reseller site.

    If you happen to live in West Africa you can see this by going to https://eMarkingAssistant.com and you will get redirected but if you to https://emarkingassistant.com/?no_redirect you can browse the site until you return back to the main page.

    If anyone has another solution (or plugin) to letting a reseller browse the site while redirecting all visitors from the target country I would be VERY grateful.

    Peter Evans

    Hi Peter,
    We found yesterday also that if a link is not using WordPress’ innate link function like in content or in the menus, and is instead in a template or otherwise outside of the usual functions, it needs this kind of if statement:

    $homelink = esc_url( home_url( '/' ) );
    if ( strpos($_SERVER['HTTP_REFERER'],'no_redirect')!==false) {
        $homelink = esc_url( home_url( '/' ) ).'?no_redirect';
    }

    We had to add this to a link in the header template that wrapped around a logo. Hope this helps!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘If is possible to set a cookie to override the geo redirection’ is closed to new replies.