Salim bin Abdullah bin Umar reported,

When the Prophet ﷺ passed by al-Hijr, he said, "Do not enter the dwellings of those who wronged themselves unless you are weeping, lest there befall you what befell them." Then he covered his head with his cloak while still mounted on his saddle.

Bukhari 3380

Sahih

حدثني محمد أخبرنا عبد الله عن معمر عن الزهري قال أخبرني

سالم بن عبد الله عن أبيه رضي الله عنهم

أن النبي ﷺ لما مر بالحجر قال لا تدخلوا مساكن الذين ظلموا أنفسهم إلا أن تكونوا باكين أن يصيبكم ما أصابهم ثم تقنع بردائه وهو على الرحل

البخاري 3380صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Hadiths of the prophets
Chapter
Allah's saying, "And to Thamud We sent their brother Salih"
Numbering
Darussalam 3380
Bukhari 3380