urlencode("https://geeksforgeeks.org/")
filter_var($var, FILTER_SANITIZE_URL); //there are various types of filters