كتاب الطهارة
2  
The Book of Purification
(17)
Chapter: Cleaning oneself after relieving oneself
(17)
باب الاِسْتِطَابَةِ ‏‏
Sahih Muslim 266a

Wasi' b. Habban reported:

I was offering my prayer in the mosque and Abdullah b. Umar was sitting there reclining with his back towards the Qibla. After completing my prayer. I went to him from one side. Abdullah said: People say when you go to the latrine, you should neither turn your face towards the Qibla nor towards Bait-ul-Maqdis. 'Abdullah said (farther): I went up to the roof of the house and saw the Messenger of Allah (ﷺ) squatting on two bricks for relieving himself with his face towards Bait-al-Maqdis.
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ بْنِ قَعْنَبٍ، حَدَّثَنَا سُلَيْمَانُ، - يَعْنِي ابْنَ بِلاَلٍ - عَنْ يَحْيَى بْنِ سَعِيدٍ، عَنْ مُحَمَّدِ بْنِ يَحْيَى، عَنْ عَمِّهِ، وَاسِعِ بْنِ حَبَّانَ، قَالَ كُنْتُ أُصَلِّي فِي الْمَسْجِدِ وَعَبْدُ اللَّهِ بْنُ عُمَرَ مُسْنِدٌ ظَهْرَهُ إِلَى الْقِبْلَةِ فَلَمَّا قَضَيْتُ صَلاَتِي انْصَرَفْتُ إِلَيْهِ مِنْ شِقِّي فَقَالَ عَبْدُ اللَّهِ يَقُولُ نَاسٌ إِذَا قَعَدْتَ لِلْحَاجَةِ تَكُونُ لَكَ فَلاَ تَقْعُدْ مُسْتَقْبِلَ الْقِبْلَةِ وَلاَ بَيْتِ الْمَقْدِسِ - قَالَ عَبْدُ اللَّهِ - وَلَقَدْ رَقِيتُ عَلَى ظَهْرِ بَيْتٍ فَرَأَيْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم قَاعِدًا عَلَى لَبِنَتَيْنِ مُسْتَقْبِلاً بَيْتَ الْمَقْدِسِ لِحَاجَتِهِ ‏.‏
Reference : Sahih Muslim 266a
In-book reference : Book 2, Hadith 78
USC-MSA web (English) reference : Book 2, Hadith 509
  (deprecated numbering scheme)