i want to validate the domain name in php using preg_match
For example these are all valid:
https://www.google.com
http://www.google.com
www.google.com
google.com
google.com/
https://www.google.com.tr/search?dcr=0&source=hp&q=web+ui&
i can validate following example only
https://www.google.com
http://www.google.com
www.google.com
google.com
$domain_validation = "/(?:http(s)?:\/\/)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z]{2,63}|[a-z0-9]{2,59})?(?:\/)+$/i";
if(preg_match("$domain_validation", $inputDomainName)){
$validSite = true;
}
and i want to validate this
google.com/
https://www.google.com.tr/search?dcr=0&source=hp&q=web+ui&
Please help to solve