What is the ruling on a group of worshippers who leave the congregational prayer inside the mosque to pray outside in the mosque's courtyard due to intense heat inside the mosque? Should one perform the prayer of Tahiyyat-ul-Masjid (salutation to the mosque) upon entering the mosque's courtyard? Or should one enter the mosque first, perform the prayer of Tahiyyat-ul-Masjid inside the mosque and then go out to the mosque's courtyard to join the congregational prayer?
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Dear questioner, you should know that Muslims are allowed to perform prayer anywhere and that every spot of the earth is considered an apt place for performing prayer; the whole earth is a mosque. The due Islamic rulings with regard to mosques are to be applicable to any place as soon as one intends to perform the prayer in it. A mosque is not merely the building intended to be a place of worship. The word "Masjid" (i.e. mosque) in the Islamic terminology does not necessarily refer to a building.
The Masjid of the Prophet, sallallaahu ‘alayhi wa sallam, had a building and an area without buildings and the whole place belonged the mosque. The rewards for the prayer therein are multiplied and the worshipper should perform the prayer of Tahiyyat-ul-Masjid upon entering any part of it.
Therefore, Muslim scholars said that the mosque's courtyard is considered a part of the mosque if it was intended to be so.
Hence, there is no harm in performing the congregational prayer outside the complex of the mosque as long as the place where the congregational prayer is performed is considered a part of the mosque. The worshipper can perform the prayer of Tahiyyat-ul-Masjid anywhere in the mosque, whether in the mosque's main building or in its courtyards.
You can search for fatwa through many choices