I am trying to create a redirect system on my site that will redirect a user from one php page to another random pages.
$rand_link=rand(20,60);
if($rand_link > 20)
{$link="/page2.php";}
if($rand_link > 30)
{$link="/page3.php";}
else
{$link="/default.php";}
header('Location: $link');
Is not working, this code is on my "main.php" file, when I enter "/main.php" I am getting redirected to 404 page of my hosting service.
Is there something wrong with my code?
How can I minimise this code? I have more then 15 links to redirect randomly?
Any help would be greatly appriciated?