[Machine] The Messenger of Allah ﷺ entered the mosque and found some of his companions' houses facing the mosque. He said, "Redirect these houses away from the mosque." Then, the Prophet ﷺ entered and the people did not do anything, hoping that he would give them permission to keep their houses as they were. However, the Prophet ﷺ came out to them again and said, "Redirect these houses away from the mosque, for I do not permit entry into the mosque for a menstruating woman or a sexually impure person." Abu Dawood said: "and this was the opinion of Al-A'miri." Al-Sheikh added that Moussa ibn Ismail reported it from Abdul Wahid except for the mention of Muhammad and the family of Muhammad ﷺ , which was narrated to us by Abu Bakr Muhammad ibn Ibrahim Al-Farsi. Ibrahim ibn Abdullah Al-Asbahani narrated it from Muhammad ibn Sulaiman ibn Faris, who reported it from Muhammad ibn Ismail Al-Bukhari, who mentioned it with his addition. Al-Bukhari said: "and according to Jassarat Al-Ajaa'ib, Urwah and Abbad ibn Abdullah reported from Aisha (may Allah be pleased with her) that the Prophet ﷺ closed all the doors except for Abu Bakr's door, and this is the most authentic narration." Al-Sheikh commented that if this is correct, it implies that one can stay within the boundaries of the mosque without having to pass through it, according to the evidence of the Quran.
جَاءَ رَسُولُ اللهِ ﷺ وَوُجُوهُ بُيُوتِ أَصْحَابِهِ شَارِعَةٌ فِي الْمَسْجِدِ فَقَالَ وَجِّهُوا هَذِهِ الْبُيُوتَ عَنِ الْمَسْجِدِ ثُمَّ دَخَلَ النَّبِيُّ ﷺ وَلَمْ يَصْنَعِ الْقَوْمُ شَيْئًا رَجَاءَ أَنْ تَنْزِلَ لَهُمْ رُخْصَةٌ فَخَرَجَ إِلَيْهِمْ بَعْدُ فَقَالَ وَجِّهُوا هَذِهِ الْبُيُوتَ عَنِ الْمَسْجِدِ؛ فَإِنِّي لَا أُحِلُّ الْمَسْجِدَ لِحَائِضٍ وَلَا جُنُبٍ قَالَ أَبُو دَاوُدَ وَهُوَ فُلَيْتٌ الْعَامِرِيُّ 4324 قَالَ الشَّيْخُ زَادَ فِيهِ مُوسَى بْنُ إِسْمَاعِيلَ عَنْ عَبْدِ الْوَاحِدِ إِلَّا لِمُحَمَّدٍ ﷺ وَآلِ مُحَمَّدٍ أَخْبَرَنَاهُ أَبُو بَكْرٍ مُحَمَّدُ بْنُ إِبْرَاهِيمَ الْفَارِسِيُّ ثنا إِبْرَاهِيمُ بْنُ عَبْدِ اللهِ الْأَصْبَهَانِيُّ ثنا مُحَمَّدُ بْنُ سُلَيْمَانَ بْنِ فَارِسٍ ثنا مُحَمَّدُ بْنُ إِسْمَاعِيلَ الْبُخَارِيُّ ثنا مُوسَى فَذَكَرَهُ بِزِيَادَتِهِ قَالَ الْبُخَارِيُّ وَعِنْدَ جَسْرَةَ عَجَائِبُ قَالَ الْبُخَارِيُّ وَقَالَ عُرْوَةُ وَعَبَّادُ بْنُ عَبْدِ اللهِ عَنْ عَائِشَةَ ؓ عَنِ النَّبِيِّ ﷺ سُدُّوا هَذِهِ الْأَبْوَابَ إِلَّا بَابَ أَبِي بَكْرٍ وَهَذَا أَصَحُّ قَالَ الشَّيْخُ وَهَذَا إِنْ صَحَّ فَمَحْمُولٌ فِي الْجُنُبِ عَلَى الْمُكْثِ فِيهِ دُونَ الْعُبُورِ بِدَلِيلِ الْكِتَابِ