I often use scripts or .htaccess for redirects of affiliate links or other outbound links, it looks like the pages are on my site and it works ok... I have a problem when I try to accomplish the following: Redirect using the PHP header(Location: xxxx) AND set the browser REFERAL value. The redirect is easy, but I NEED to set the referal value so I can track WHICH script (not link) performed the redirect. When doing a PHP header() redirect, the browser's referal value will be the page that contained the LINK that was clicked... I need to know which redirection script was used (since I use different ones, it's part of an experiment...). I need to set the browser's referal value AND redirect to the new location. Is this possible using PHP? If I use JavaScript, a simple JS redirect will leave the proper referal info, but I don't want to use JS since some people dissable it and that means lost sales. PLEASE HELP!
Not possible. The end user's referring URL is read only. You would need to track it with something unique in the URL or maybe with a cookie.
Yes a cookie is easy enough but the reason I was hoping to do it via PHP is so it can be 100% fail safe. JS and cookies can be very easily blocked, and usually are by many people who use pop-up and ad blockers. It's no big deal, I'll probably just do it by implementing a JavaScript redirect (for the instant redirect) and just in case they have JS blocking I'll also do a meta refresh for 3 sec. That way the JS (if allowed) will redirect them and write the refferer info, and if the JS doesn't get run the meta refresh will redirect them without the referal info. It's a compromise but I hope it will solve my problem. If I notice a drop in sales/conversions I will just resort to a normal PHP or .htaccess redirect and who cares about my little tracking experiment... it's the $$ that count.
Why don't you embed the referer url in the destination url? like: http://blah.com/blah.php?ref=http://blah.com/blah2.php
because I use redirects to "clean up" the urls and make it look nice. There are a lot of people who don't click on URLs with ref details! the URLs I use: mydomain.com/go/newpage is nicer to look at than the long URLs needed to accomplish the proper tracking... it's not a big deal. I will try several different solutions and see what works best. Thanks all for the tips.