Shaykh Muhammad ibn Uthaymeen (may Allaah have mercy on him) said:
If the pilgrim wants to visit the Prophet's Mosque before or after Hajj, he should have the intention of visiting the mosque, not the grave, because travelling to a place for the purpose of worship does not include visiting graves, rather it includes only the three mosques: al-Masjid al-Haraam (the Sacred Mosque in Makkah), al-Masjid al-Nabawi (the Prophet's Mosque in Madeenah) and al-Masjid al-Aqsa (in Jerusalem), as it says in the hadeeth which was narrated from the Prophet (peace and blessings of Allaah be upon him) who said: No journey should be undertaken to any mosque except three: al-Masjid al-Haraam, this mosque of mine and al-Masjid al-Aqsa. Narrated by al-Bukhaari, 1189: Muslim, 1397.
When he reaches the Prophet's Mosque, he should enter with his right foot first and say, Bismillaah wa'l-salaatu wa'l-salaam ala Rasoolillaah. Allaahumma ighfir li dhunoobi waftah li abwaab rahmatika. A'oodhu Billaah il-azeem wa bi wajhihi'l-kareem wa bi sultaanihi'l-qadeem min al-shaytaan il-rajeem (In the name of Allaah, and peace and blessings be upon the Messenger of Allaah. O Allaah, forgive my sins and open to me the gates of Your mercy. I seek refuge in Allaah the Almighty and in His noble Face and in His eternal Power, from the accursed Shaytaan). Then he should pray as he likes.
It is better for him to pray in al-Rawdah which is the area between the minbar of the Prophet (peace and blessings of Allaah be upon him) and the room in which is his grave, because this area is one of the gardens (riyaadh, sing. rawdah) of Paradise. When he has prayed and wants to visit the grave of the Prophet (peace and blessings of Allaah be upon him), he should stand in front of it in a dignified manner and say, Assalaamu alayka ayyuha'l-Nabiyyu wa rahmat-Allaahi wa barakaatuhu. Allaahumma salli ala Muhammad wa ala aali Muhammad kama salayta ala Ibraaheem wa ala aali Ibraaheem, innaka hameedun majeed; Allaahumma baarik ala Muhammad wa ala aali Muhammad kama baarakta ala Ibraaheem wa ala aali Ibraaheem, innaka hameedun majeed. Ashhadu annaka Rasool-Allaah haqqan wa annaka qad balaghta al-risaalah wa adayta al-amaanah wa nasahta al-ummah wa jaahadta fillaahi haqqa jihaadihi. Fa jazaka Allaahu an ummatika afdal ma jaza nabiyyan an ummatihi (Peace be upon you, O Prophet, and the mercy of Allaah, and His blessings. O Allaah, send prayers upon Muhammad and upon the family of Muhammad, as You sent prayers upon Ibraaheem and the family of Ibraaheem, verily You are Worthy of Praise, Full of Glory. O Allaah, send blessings upon Muhammad and upon the family of Muhammad, as You sent blessings upon Ibraaheem and the family of Ibraaheem, verily You are Worthy of Praise, Full of Glory. I bear witness that you are indeed the Messenger of Allaah, that you conveyed the message and fulfilled the trust, and advised the ummah and strove truly for the sake of Allaah. May Allaah reward you on behalf of your ummah better than any Prophet is rewarded on behalf of his nation).
Then he should move a little to his right and send salaams upon Abu Bakr al-Siddeeq and pray that Allaah be pleased with him.
Then he should move a little further to his right and send salaams upon Umar ibn al-Khattab and pray that Allaah be pleased with him. If he makes du'aa' for Abu Bakr and Umar (may Allaah be pleased with them) in an appropriate manner, that is good.
It is not permissible for anyone to seek to draw closer to Allaah by touching the hujrah of the Prophet (peace and blessings of Allaah be upon him) or by circumambulating it, or by facing it whilst making du'aa'. Rather he should turn to face the qiblah, because drawing closer to Allaah can only be done by means of that which Allaah and His Messenger have prescribed. Acts of worship are based on following not on innovation.
Women should not visit the grave of the Prophet (peace and blessings of Allaah be upon him) or any other grave, because the Prophet (peace and blessings of Allaah be upon him) cursed women who visit graves. Narrated by al-Tirmidhi and classed as hasan by al-Albaani in Saheeh al-Tirmidhi, 843. Rather a woman should pray and send blessings upon the Prophet (peace and blessings of Allaah be upon him) in the place where she is, and that will reach the Prophet (peace and blessings of Allaah be upon him) no matter where she is. The Prophet (peace and blessings of Allaah be upon him) said: Send blessings upon me, for your blessings will reach me no matter where you are. And he said, Allaah has angels who travel about throughout the land, conveying to me the salaams of my ummah. Narrated by al-Nasaa'i, 1282; classed as saheeh by al-Albaani in Saheeh al-Nasaa'i, 1215.
Only men should visit al-Baqee', which is the graveyard of Madeenah. They should say: Al-salaamu alaykum ahl al-diyaar min al-mu'mineen wa'l-muslimeen, wa innaa in sha Allaah bikum laahiqoon. Yarham Allaah al-mustaqdimeena mina wa minkum wa'l-musta'khireen. Nas'al Allaah lana wa lakum al-aafiyah. Allaahumma la tahrimna ajrahum wa la taftinna ba'dahum waghfir lana wa lahum (Peace be upon you, O dwellers of these abodes, believers and Muslims. We will, when Allaah wills, join you. May Allaah have mercy on those who were first (to die) and those who were last. We ask Allaah to grant salvation to us and you. O Allaah, deprive us not of reward (similar to theirs) and lead us not astray after they are gone; forgive us and them).
If he then wants to go to Mount Uhud and remember what happened there to the Prophet (peace and blessings of Allaah be upon him) and his companions in that battle of jihad, trials and martyrdom, and send salaams upon the shuhada' (martyrs) there, such as Hamzah ibn Abd al-Muttalib, the paternal uncle of the Prophet (peace and blessings of Allaah be upon him), there is nothing wrong with that, because that is a kind of travelling through the land as enjoined (in Islam) [cf. al-Nahl 16:36]. And Allaah knows best.
Reproduced from Islam QA