Mishkat al-Masabih 1667
وَعَنِ الْمُغِيرَةِ بْنِ شُعْبَةَ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ: «الرَّاكِبُ يَسِيرُ خَلْفَ الْجَنَازَةِ والماشي يمشي خلفهَا وأمامها وَعَن يَمِينهَا وَعَن يسارها قَرِيبا مِنْهَا وَالسَّقْطُ يُصَلَّى عَلَيْهِ وَيُدْعَى لِوَالِدَيْهِ بِالْمَغْفِرَةِ وَالرَّحْمَةِ» . رَوَاهُ أَبُو دَاوُدَ وَفِي رِوَايَةِ أَحْمَدَ وَالتِّرْمِذِيِّ وَالنَّسَائِيّ وَابْن مَاجَه قَالَ: «الرَّاكِب خلف الْجِنَازَة وَالْمَاشِي حَيْثُ شَاءَ مِنْهَا وَالطِّفْلُ يُصَلَّى عَلَيْهِ» وَفِي المصابيح عَن الْمُغيرَة بن زِيَاد
From al-Mughirah ibn Shuʿbah, that the Prophet ﷺ said: "The rider goes behind the funeral, and the one walking walks behind it, in front of it, on its right and on its left, close to it. And the prayer is offered over the miscarried child, and supplication is made for his parents for forgiveness and mercy." Reported by Abu Dawud. And in the narration of Ahmad, at-Tirmidhi, an-Nasaʾi and Ibn Majah he said: "The rider [goes] behind the funeral, the one walking wherever he wishes in relation to it, and the prayer is offered over the child." And in al-Masabih: from al-Mughirah ibn Ziyad.