When you go to relieve yourselves, do not face the qiblah while urinating or defecating, but turn toward the east or the west.When we arrived in Syria, we found latrines that had been built facing the qiblah, so we would turn aside from it and seek Allah's forgiveness.
حدثنا مسدد بن مسرهد حدثنا سفيان عن الزهري عن عطاء بن يزيد الليثي
إذا أتيتم الغائط فلا تستقبلوا القبلة بغائط ولا بول ولكن شرقوا أو غربوا فقدمنا الشام فوجدنا مراحيض قد بنيت قبل القبلة فكنا ننحرف عنها ونستغفر الله
Bukhari transmitted it in the Book of Prayer, Chapter on the qiblah of the people of Madinah, Syria, and the East, no. 394, and Muslim in the Book of Purification, Chapter on cleaning oneself, no. 264, from the hadith of Sufyan bin Uyayna with this same chain. Tirmidhi also narrated it, no. 318, as did Nasai, nos. 20-22, and Ibn Majah, no. 318, and Tirmidhi said, hasan.