I need a script that will output a URL that will randomly redirect to one of my landing pages (to evenly distribute traffic from a single source) Anyone know of a good script to accomplish this? PS prosper202 wont work since my traffic does not come through a search engine.
Something like this? <? $sites = array( "http://google.com", "http://yahoo.com", "http://bing.com", "http://digg.com", "http://amazon.com"); $randomSite = array_rand(array_flip($sites), 1); header("Location: $randomSite"); ?> Code (markup):
You simply need to assign your pages to the array here's my code that I use http://www.jaygilford.com/php/random-redirects-to-sites-with-php-script/ If you want to redirect to pages on the same domain you can just use $sites = array( '/blog/index.php', '/forums/', '/about.php' ) PHP: