How can I make a variable depending on the url?

0

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"); ;
?>
    
asked by Oscar David 25.08.2018 в 17:55
source

1 answer

3

You can do it like this:

$url = 'https://www.' . $to;

It's a concatenation

    
answered by 25.08.2018 в 18:07