I was asked to introduce a unified self hosted URL-Shortener/Forwarder/Tracking Service for an website that earns money from affiliates. One example I found was one of the bigger german sites for bargains. (mydealz)

So I had a look at their way of doing it, and I was quite surprised.

From my point of view, the only sensible way to do the forwarding and tracking is using a PHP header redirect, if 301 or 302 in my eyes is mainly a question wether you want to double track double links or not.

But they do the forward using a small page using javascript window.location.href. But why?

Screenshot MyDealz forwarder

Is there any advantage that I don't see? Are there any disadvantages of the PHP redirect?

As far I as tested no referer are lost while using header redirect.

Thanks in advance for your help.

2 Answers 2


I always lean towards a server side redirect for this sort of thing as well. The only possible disadvantage I could see (though I don't consider it one) is that by using server side 301's your affiliate links aren't likely to get indexed in Google. If you don't care about getting your redirect links indexed then it seems to me that a server side redirect is much more reliable and makes a lot more sense in the case you presented.

  • I totally agree with you. That's why I was surprised to see them doing it that way. Jun 26, 2014 at 21:39
  • @ChristophDaum the only reason I can think of for them to do this is to get them indexed. Jun 26, 2014 at 21:41
  • Sure true. But those pages don't have any real content. Unless they do black hat and deliver different content to google. I'll check that tomorrow. But even if not. Google doesn't like these kind of forwards as far as I know. And it's at least a grey hat Seo method. Correct me if I'm wrong on that point. Jun 26, 2014 at 21:47
  • You are correct, I'd stick with server side redirects unless you have some very specific reason not to. Jun 26, 2014 at 21:56
  • I've just checked that. And look what I found in the robots.txt User-agent: * Allow: / Disallow: /visit. So it's not about being indexed. Jun 27, 2014 at 6:19

I just found the solution myself. There is no way to modify the referer using PHP, as this is being sent by the browser. The script I posted above is basically the same script, just without Step 1, posted by @honyovk on Stackoverflow in this topic. https://stackoverflow.com/questions/6428762/hide-referrer-on-click/11249553#11249553

And probably the idea is to make sure that if someone shares the link, it still sets the correct referrer to ensure that an affiliate network relying on refferer still tracks the sale/lead/click to the right account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.