Abdullah bin Umar reported,

When the Prophet ﷺ passed by al-Hijr, he said, "Do not enter the dwellings of those who wronged themselves, lest there befall you what befell them, unless you are weeping." Then he covered his head and quickened his pace until he had crossed the valley.

Azami 14772

Sahih

عن ابن عمر قال

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

الأعظمي 14772صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Superior moral conduct
Chapter
Etiquette of the road, walking, and travel
Section
Etiquette of passing by the dwellings of a punished people
Numbering
Jami al-Kamil 14772 (2nd edition)
Azami 14772