So in my previous post Time to do a little redirect I explained that I have set the folder structure up to allow affiliate links.
So the code I use in each folder contains a file called index.php with the code like…
<?php
header("location: affiliate_link_url ");
exit();
Where affiliate_link_url is the actual affiliate link of the program/product I am promoting.
Or if you want to use HTML you could use something like
<meta http-equiv=”refresh” content=”delay_time; URL=affiliate_link_url” />
Being a PHP Programmer, I just like the PHP version. PLUS it will allow me to add in some magic down the track… Stay tuned for that one!
The actual proper way is to read the URL and look it up in a Database for the redirect. This allows you to do all sorts of fun stuff like tracking etc. Plus it lets you change things up a bit. But in the case of a Page Not Found or 404 Error, you can throw up a page with all your links and little descriptions associated with each to give them something… or have a default redirect in the case a “program” falls out of favour and you still have active links out there…
The hard part is never the programming, that’s super simple part. The hard part is working out what you want.