Exoon Posted May 27, 2011 Share Posted May 27, 2011 Hi, Ive got a script to redirect some traffic from one site to another as follows: $checker = $_SERVER['HTTP_REFERER']; if($checker == "http://siteone.com) { header("Location: http://www.sitetwo.com"); } It works fine but when the URL is like site.com/anotherpage.php it dosen't redirect. How can i redirect no matter what page siteone is on Quote Link to comment https://forums.phpfreaks.com/topic/237671-redirect-to-other-site/ Share on other sites More sharing options...
mikesta707 Posted May 27, 2011 Share Posted May 27, 2011 you can use the strpos() function. For example $checker = $_SERVER['HTTP_REFERER']; $str = "siteone.com"; if (strpos($checker, $str) !== false){ header("Location: http://www.sitetwo.com"); } Quote Link to comment https://forums.phpfreaks.com/topic/237671-redirect-to-other-site/#findComment-1221345 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.