MyBB Community Forums

Full Version: how to create a Redirect URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wants to make a URL which can redect to any of my forum thread WHICH IS EXISTING like
https://post4vps.com/thread-208.html
https://post4vps.com/thread-186.html
https://post4vps.com/thread-123.html
 like i have a link called goom.tk and when anyone clicks on it then he/she redirected to any of my forum thread which is excisting

i tried but i can only able to get this
<meta http-equiv="refresh" content="0; URL=https://redirected.com">

which only redirect user to only 1 specified link Sad

i guess i am able to explain what i needed
So you want to have it choose a random thread?

$query = $db->simple_select("threads", "tid", "visible=1");
$tids = array();
while($thread= $db->fetch_array($query))
{
$tids[] =get_thread_link($thread['tid']);
}
$max = count($tids) -1;
$chosenthread = mt_rand(0, $max);
$threadlink = $tids[$chosenthread];
$message = "You are being redirected.";
redirect($threadlink, $message);