jeudi 9 juillet 2015

Random redirect evenly php

I have a simple php code that redirect to random uri from array. However, after a while i've noticed its not evenly load balanced. Can someone suggest tweaking so it will be evenly redirecting between the links ?

<?php 
$urls = array('https://a.com', 
               'http://b.com', 
               'http://c.com', 
               'http://d.com',
               'https://e.com',
               'https://f.com'
               ); 
shuffle($urls);
header('Location: ' . $urls[0]);
exit();
?>

Thanks




Aucun commentaire:

Enregistrer un commentaire