MYSQL To get domain from url
SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'www.' FROM TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(referring_url)))), '/', 1), ':', 1)
eg: referring_url = www.blogger.com it will return blogger.com
If www. needed the use below query
SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(referring_url))), '/', 1), ':', 1)