$site = "site.com/facebook-videolari.html";
$bol = explode("/", $site);
$cek = explode(".", $bol[1]);
$adi = $cek[0];
$down = $adi.".rar";

// yada

$degistir = str_replace(".html", ".rar", $bol[1]);
bu şekilde olabilir yanlış anlamadıysam