https:// $url = trim(strtolower($url)); $url = preg_replace('/\s+/', '', $url); $url = str_replace("www/", "www.", $url); $url = str_replace("http:\\\\", "", $url); if (!preg_match('#^https?://#', $url)) { $url = "http://$url"; } // $url = str_replace("http://", "https://", $url); $arr = parse_url($url); $url = $arr['scheme'] . '://' . $arr['host'] . '/'; // $url = str_replace("www.", "", $url); $url = str_replace("_", "/", $url); return trim($url); } }