Scusa ho sbagliato:

$sql = "SELECT distinct(SUBSTRING_INDEX(link, '/', 1)) FROM TABELLA";