PHP - Page Redirection Links

Recently, I had a project that needed to redirect links through an internal page. The client was trying to isolate some specific analytics and user behavior but obviously you can use this use for a variety of purposes. You will be surprised how simple it is to implement. Let me know if you have any difficulties with the code.

For this project, I created a page called go.php to control the URL/Link redirections.

Here is the code to put on the go.php page:

_________________________________________________

< ? PHP

if ($o == “site1″) {$link = “http://www.vonfelten.com”;} // Default link
if ($o == “site2″) {$link = “http://sem.vonfelten.com”;}
if ($o == “site3″) {$link = “http://blog.vonfelten.com”;}
if ($o == “site4″) {$link = “http://forums.vonfelten.com”;}

header(”Location: $link”); // Jump to the URL
exit();
?>

note: you can add parameters to the urls if you want. Be sure and use best practices so you don’t run into any issues. Parameters on a URL should be:

http://www.yoursitename.com/?parameter=value

or

http://www.yoursitename.com/?parameter=value&parameter2=value2,

and so on.
_________________________________________________

That’s it… Your ready to test it.

This would be the link you would reference on the page:

http://www.vonfelten.com/blog/go.php?o=site1
_________________________________________________

The next step would be to track some information in a log file (i.e. the number of clicks, unique visitors, search phrases, browser information, etc.)

If you are interested in seeing that code, hit me up on email.

del.icio.us:PHP - Page Redirection Links  digg:PHP - Page Redirection Links  spurl:PHP - Page Redirection Links  wists:PHP - Page Redirection Links  simpy:PHP - Page Redirection Links  newsvine:PHP - Page Redirection Links  blinklist:PHP - Page Redirection Links  furl:PHP - Page Redirection Links  reddit:PHP - Page Redirection Links  fark:PHP - Page Redirection Links  blogmarks:PHP - Page Redirection Links  Y!:PHP - Page Redirection Links  smarking:PHP - Page Redirection Links  magnolia:PHP - Page Redirection Links  segnalo:PHP - Page Redirection Links

Related Entries

0 Responses to “PHP - Page Redirection Links”


  1. No Comments

Leave a Reply