Redirect to an affiliate using PHP or JavaScript redirect?

Redirect to an affiliate using PHP or JavaScript redirect? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Redirect to an affiliate using PHP or JavaScript redirect? error on your web browser. Problem :


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.


Solution :

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 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.


We hope that this article has helped you resolve the php, redirects, javascript error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=