It is narrated from Sayyiduna Jabir bin Abdullah (may Allah be pleased with him) that a man said: O Messenger of Allah! I had vowed that if Allah grants you the conquest of Makkah, I would go to Bayt al-Maqdis and pray there. The Prophet (peace and blessings of Allah be upon him) said: "Pray here (in the Ka'bah)." He repeated his question three times, then the Messenger of Allah (peace and blessings of Allah be upon him) said: "Now it is up to you" (meaning you have the choice to go to Bayt al-Maqdis and pray there and fulfill your vow).
Hadith Referenceسنن دارمي / من النذور و الايمان / 2376
Hadith Takhrijاس حدیث کی سند صحیح ہے۔ دیکھئے: [أبوداؤد 3305] ، [أبويعلی 2116] ، [ابن الجارود 945] ، [الحاكم 304/4] ، [البيهقي فى المعرفة 19707]
Brief Explanation
(Commentary on Hadith 2375)
From this hadith, it is established that if someone makes a vow (mannat or nazr) to perform prayer in Bayt al-Maqdis (Jerusalem), he may fulfill his vow by performing prayer in Bayt Allah al-Sharif (the Sacred House, i.e., the Ka‘bah), and his vow will be considered fulfilled. This is because Bayt Allah al-Haram is superior to Bayt al-Maqdis, and the reward for prayer in Bayt Allah is much greater than that for prayer in Bayt al-Maqdis. When this person insisted repeatedly, the Prophet sallallahu alayhi wa sallam said: "You are seeking hardship for yourself, so go, fulfill your vow there, and perform prayer in Bayt al-Maqdis."
The noble Prophet sallallahu alayhi wa sallam said: «اَلدِّيْنُيُسْرٌوَلَنْيُشَّادَّالدِّيْنَأَحَدٌإِلَّاغَلَبَهُ.» meaning: The religion is easy, and whoever makes the religion hard upon himself, the religion will overcome him.