Yahya related to me from Malik from Ishaq ibn Abdullah ibn Abi Talha that Rafiibn Ishaq, a mawla of the family of ash-Shifa who was known as the mawla of Abu Talha, heard Abu Ayyub al-Ansari, one of the companions of the Messenger of Allah ﷺ say, while he was in Egypt, "By Allah! I don't know how to deal with these lavatories." The Messenger of Allah ﷺ said, "When you go to defecate or urinate, do not expose your genitals towards the qibla, and do not put your back to it."
عَنْ رَافِعِ بْنِ إِسْحَاقَ مَوْلًى لآلِ الشِّفَاءِ وَكَانَ يُقَالُ لَهُ مَوْلَى أَبِي طَلْحَةَ أَنَّهُ سَمِعَ أَبَا أَيُّوبَ الأَنْصَارِيَّ صَاحِبَ رَسُولِ اللَّهِ ﷺ وَهُوَ بِمِصْرَ يَقُولُ وَاللَّهِ مَا أَدْرِي كَيْفَ أَصْنَعُ بِهَذِهِ الْكَرَايِيسِ وَقَدْ قَالَ رَسُولُ اللَّهِ ﷺ إِذَا ذَهَبَ أَحَدُكُمُ الْغَائِطَ أَوِ الْبَوْلَ فَلاَ يَسْتَقْبِلِ الْقِبْلَةَ وَلاَ يَسْتَدْبِرْهَا بِفَرْجِهِ