I'm trying to get this php redirect depending on the variable $ to have the include, and try to change preg_match by array but it just throws me 500 error, which could be and how I could make it work, thanks.
<?php
include('url.php');
$urls = preg_match(
'https://www.',.rawurlencode($to).,);
$url = $urls[array_rand($urls)];
header("Location: $url"); ;
?>