Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:2248Abū al-Ḥasan ʿAlī b. Muḥammad b. Yūsuf al-Raffāʾ > Abū ʿAmr ʿUthmān b. Muḥammad b. Bashīr > Ismāʿīl b. Isḥāq al-Qāḍī > Ismāʿīl b. Abū Ūways > ʿAbd al-Raḥman b. Abū al-Zinād from his father

[Machine] From the scholars of the people of Madinah, it is reported that they used to say: "Whoever prays without being in a state of purity or without facing the qiblah should repeat the prayer, whether it was performed within its proper time or outside of it, unless their mistake was a slight deviation from the qiblah or a minor mistake." And it has been narrated from Ibrahim al-Nakha'i that he said: "Whoever prays towards a direction other than the qiblah does not need to repeat the prayer."  

البيهقي:٢٢٤٨أَخْبَرَنَا أَبُو الْحَسَنِ عَلِيُّ بْنُ مُحَمَّدِ بْنِ يُوسُفَ الرَّفَّاءُ ثنا أَبُو عَمْرٍو عُثْمَانُ بْنُ مُحَمَّدِ بْنِ بَشِيرٍ ثنا إِسْمَاعِيلُ بْنُ إِسْحَاقَ الْقَاضِي ثنا إِسْمَاعِيلُ بْنُ أَبِي أُوَيْسٍ ثنا عَبْدُ الرَّحْمَنِ بْنُ أَبِي الزِّنَادِ عَنْ أَبِيهِ

عَنِ الْفُقَهَاءِ مِنْ أَهْلِ الْمَدِينَةِ أَنَّهُمْ كَانُوا يَقُولُونَ مَنْ صَلَّى عَلَى غَيْرِ طُهْرٍ أَوْ عَلَى غَيْرِ قِبْلَةٍ أَعَادَ الصَّلَاةَ كَانَ فِي الْوَقْتِ أَوْ غَيْرِ الْوَقْتِ إِلَّا أَنْ يَكُونَ خَطَاؤُهُ الْقِبْلَةَ تَحَرُّفًا أَوْ شَيْئًا يَسِيرًا وَرُوِّينَا عَنْ إِبْرَاهِيمَ النَّخَعِيِّ أَنَّهُ قَالَ فِي الَّذِي يُصَلِّي لِغَيْرِ الْقِبْلَةِ لَا يُعِيدُ