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 hastened his pace until he had crossed the valley.

Azami 9269

Sahih

عن ابن عمر قال

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

الأعظمي 9269صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Biography of the Prophet ﷺ
Chapter
Expedition of Tabuk, which was in the year nine without disagreement
Section
Passing of the Prophet ﷺ by Hijr, the dwellings of Thamud
Numbering
Jami al-Kamil 9269 (2nd edition)
Azami 9269