Umar bin Khattab reported,

While he was addressing the people, he said, "I heard the Messenger of Allah ﷺ say, 'Actions are only by intentions, and every person will have only what he intended. So whoever's migration was to Allah and His Messenger, his migration is to Allah and His Messenger. And whoever's migration was for some worldly gain he sought, or a woman he wished to marry, his migration is to whatever he migrated for.'"

Ahmad 300

Sahih

حدثنا يزيد أنبأنا يحيى بن سعيد أن محمد بن إبراهيم أخبره أنه سمع علقمة بن وقاص الليثي يقول إنه سمع

عمر بن الخطاب رضي الله عنه

وهو يخطب الناس وهو يقول سمعت رسول الله ﷺ يقول إنما العمل بالنية وإنما لامرئ ما نوى فمن كانت هجرته إلى الله وإلى رسوله فهجرته إلى الله وإلى رسوله ومن كانت هجرته لدنيا يصيبها أو امرأة يتزوجها فهجرته إلى ما هاجر إليه

أحمد 300صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Umar bin Khattab
Numbering
Darussalam 300
Ahmad 300