Ok, so basically i am using this existing code to redirect to a different page. I send traffic from adwords to www.mydomain.com/site1.php, which forwards to www.mydomain.com/page/. The referrer of the next page www.google.com shows www.mydomain.com/page/. If i were to do a header redirect, it would show www.mydomain.com/site1.php as the referrer, which is no good. So, my problem lies with the script not redirecting fast enough. My page loads, and then it redirects, but it is very slow. I don't want them to see the page if possible, but it still needs to pass on the referrer. <?php $site1 = "http://www.mydomain.com/site1.php"; $affiliate_link = "http://www.mydomain.com/page/"; if($_SERVER['HTTP_REFERER'] == $site1) { echo "<body onload=\"javascript:frmClickTracking.submit();\">"; echo "<form action=\"" . $affiliate_link . "\" method=\"post\" name=\"frmClickTracking\">"; echo "</form>"; } ?> Code (markup):
Hello, So u need to redirect right. so here what u can do <?php $site1 = "http://www.mydomain.com/site1.php"; $affiliate_link = "http://www.mydomain.com/page/"; if($_SERVER['HTTP_REFERER'] == $site1) { echo "<script>location.href='$affiliate_link '</script>"; } else { ////////////You can write things here...display the other contents which you want to show when the condition is false////////////// } ?> PHP: Regards, Stylesofts Developing Team
I remember that you can send referer using headers in this way: header('Referer:'.$site1); Code (markup): But not sure if it will work. If you want to use javascript, you should not put onload as it will wait till the page loads then execute.
WOW! Thank you very much guys! I ended up using StyleSofts's code. I literally spent hours messing/searching for code. My hats off to you!