Hadith Q432

وَأَنَّ اللَّهَ- عَزَّ وَجَلَّ- إِنَّمَا أَرَادَهُ بِقَوْلِهِ‏:‏ ‏[‏فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ‏)‏؛ لِأَنَّ الْكَعْبَةَ فِي الْمَسْجِدِ الْحَرَامِ، وَإِنَّمَا أُمِرَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَالْمُسْلِمِينَ أَنْ يُصَلُّوا إِلَى الْكَعْبَةَ إِذِ الْقِبْلَةُ إِنَّمَا هِيَ الْكَعْبَةُ لَا الْمَسْجِدُ كُلُّهُ، إِذِ اسْمُ الْمَسْجِدِ يَقَعُ عَلَى كُلِّ مَوْضِعٍ يُسْجَدُ فِيهِ‏.‏
And by the blessed command of Allah Almighty (فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ) "So turn your face toward Al-Masjid Al-Haram," what is meant is the Noble Ka'bah, because the Noble Ka'bah is within Al-Masjid Al-Haram. And Allah Almighty has commanded the Noble Prophet ﷺ and the Muslims to face the Noble Ka'bah while performing prayer, because the qiblah is only the Noble Ka'bah, not the entire Al-Masjid Al-Haram, because the term "masjid" applies to the whole place where prostration is performed.
Hadith Reference صحيح ابن خزيمه / جماع أبواب الأذان والإقامة / Q432