 Traces of human presence in the area date to the 6th-5th centuries BC.The current town was however founded in the 5th-6th centuries AD as Massa di S. Ambrogio.Starting from the 10th century, there were fortifications and castles, whence the toponym Castrum Rivi from which the current name derives.