Is the two-rak'ah prayer for greeting the mosque obligatory for someone who exited the mosque but remained within the same building, and then returned to it?
Greeting the mosque (Tahiyyat al-Masjid) is a confirmed Sunnah for one who enters the mosque in a state of purity (wudu'). The recommendation for it, if one exits and then returns, differs among the madhhabs. The Malikis and Hanafis do not recommend it if one returns shortly after leaving. In contrast, the Shafi'is and Hanbalis do recommend it, and this is the choice of Shaykh al-Islam. Going to an upper or lower floor that is not part of the mosque is considered an exit from it, and it is recommended for one who returns thereafter to pray the greeting.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/82509