How to create a URL rotator step by step

If you are doing some kind of online marketing, you probably know, how important it is to test all your stuff….

Therefore, you will also have to test your landing-pages, sales-pages etc.

A very effective way to do that is to use a URL rotator, and why pay lots of money for an advanced one, when you can make a simple one yourself…

Here is a step by step recipe…

$urls[] = "";
$urls[] = "";
$urls[] = "";
srand ((double) microtime( )*1000000);
$random = rand(0,count($urls));
header("location:" . $urls[$random]);

Put this code into a text editing program, save it as a .php file and upload it onto your server.


  1. Hi Uffe.

    Thank you for your PHP code. I am looking forward exactly for rotator code recently. However, it doesn’t fork for me.

    I’ve inserted three URLs into your code just for testing and uploaded the code as index.php in some folder on my server.

    It said: “Parse error: syntax error, unexpected ‘:’ in /home1/myhostingname/public_html/MYSITE.COM/test/index.php on line 3”

    Can I ask you to contact me by Email I’ve provided?

    Thank you

    • Hi Pavel…

      I have had some troubles making it work as well – it seems to be because of the text editing software that we use to edit and save the code with. Some editing software saves the code in the “RTF” format which means Rich Text Format… For the code to work, it has to be saved as plain and simple text.

      Hope it makes sense…

Add a Comment

Your email address will not be published. Required fields are marked *

four × 5 =