For example, the link site.ru in the Instagram profile was redirected to site.ru/instagram, respectively, site.ru in the facebook profile led to site.ru/facebook. In all other cases, led as it is - to home.

    1 answer 1

    Check with regular expression $ _SERVER ['HTTP_REFERER'].

    Sort of:

    if (preg_match("www.facebook.com", $_SERVER['HTTP_REFERER'])) { header('Location: http://site.ru/facebook/'); } else if (preg_match("www.instagram.com", $_SERVER['HTTP_REFERER'])) { header('Location: http://site.ru/instagram/'); } else header('Location: http://site.ru/'); 
    • thank. but it does not plow :( ERR_TOO_MANY_REDIRECTS As far as I studied the issue with the redirect, the referrer remains the original therefore such a trouble. But it could probably be solved - by checking only the main page. However, a transition not from these social networks also leads to this error. Not I will understand why ... Maybe I’m not installing it correctly. CMS WP - inserted into function.php - Diesel