This point is established by continuous, undeniable transmission as part of the very religion brought by the Messenger ﷺ. He commanded the building of mosques and the performance of prayer within them, but he never commanded the construction of a shrine—whether over the grave of a prophet or of anyone else, nor at a site associated with a prophet. In the days of the Companions, the Successors, and those who followed them, there existed throughout the Muslim lands—whether the Ḥijāz, Syria, Yemen, Iraq, Khurāsān, Egypt, or the Maghrib—no mosque erected upon a grave and no shrine intentionally set up for visitation. None of the early generations went to the grave of a prophet or any other person in order to supplicate there. The Companions themselves did not go to the grave of the Prophet ﷺ, or to the graves of other prophets, seeking to make supplication; they would simply offer prayers of blessing and peace upon the Prophet ﷺ and upon his two Companions.
The leading jurists agree that if a person makes supplication inside the Prophet’s Mosque, he should not face the grave. They differed, however, with regard to extending greetings. Mālik, Aḥmad, and others maintained that one should face the grave and convey the greeting; this is also reported by al-Shāfiʿī’s followers, and I believe it is his explicit position. Abū Ḥanīfah, by contrast, held that one should face the qiblah while offering the greeting, and this is how it is recorded in the works of his students.