Jump to content

mat1987

New Members
  • Posts

    3
  • Joined

  • Last visited

mat1987's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks a lot guys. The final working code is: $referrer = $_SERVER['HTTP_REFERER']; if (preg_match('~example\.com$~', parse_url($referrer, PHP_URL_HOST))) { print ('<meta http-equiv="refresh" content="0; URL=http://www.mysite.com/1.php">'); }
  2. actually none. I'm not a pro just need to detect the root domain and if the root domain is example.com, then do the redirect, regardless of any subdomains or subdirectories like blog.example.com or example.com/blog
  3. Hi, I'm using this code to redirect visitors who are coming from another site (clicking on my ad on that site) to a page in my site where I can track them: $referrer = $_SERVER['HTTP_REFERER']; if ( strstr($referrer, '://example.com/shop') ) print ('<meta http-equiv="refresh" content="0; URL=http://www.mysite.com/1.php">'); The problem is that, by this code I can only redirect those who are coming from example.com/shop, but I need to redirect visitors coming from any sub directory or subdomain from example.com, not only a specific url in example.com Is there any solution? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.