Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:17027Abū Saʿīd b. Abū ʿAmr > Abū al-ʿAbbās Muḥammad b. Yaʿqūb > al-Rabīʿ > al-Shāfiʿī > a man > Ibn Abū Dhiʾb > al-Qāsim b. al-Walīd > Yazīd Urāh Ibn Madhkūr > ʿAlī

that ʿAlī ؓ stoned a Lūṭī (homosexual)  

Shāfiʿī said and from this we take stoning of a homosexual whether married or not and this is the opinion of Ibn ʿAbbās. And he said that Saʿīd b. al-Musayyib says that it is from the Sunnah to stone a homosexual whether married or not. ʿIkrimah narrates from Ibn ʿAbbās from the Prophet ﷺ that is what we have mentioned.
البيهقي:١٧٠٢٧وَأَخْبَرَنَا أَبُو سَعِيدِ بْنُ أَبِي عَمْرٍو ثنا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ أنبأ الرَّبِيعُ قَالَ قَالَ الشَّافِعِيُّ عَنْ رَجُلٍ عَنِ ابْنِ أَبِي ذِئْبٍ عَنِ الْقَاسِمِ بْنِ الْوَلِيدِ عَنْ يَزِيدَ أُرَاهُ ابْنَ مَذْكُورٍ أَنَّ عَلِيًّا ؓ رَجَمَ لُوطِيًّا قَالَ الشَّافِعِيُّ وَبِهَذَا نَأْخُذُ يُرْجَمُ اللُّوطِيُّ مُحْصَنًا كَانَ أَوْ غَيْرَ مُحْصَنٍ وَهَذَا قَوْلُ ابْنِ عَبَّاسٍ قَالَ وَسَعِيدُ بْنُ الْمُسَيِّبِ يَقُولُ السُّنَّةُ أَنْ يُرْجَمَ اللُّوطِيُّ أُحْصِنَ أَوْ لَمْ يُحْصِنْ وَعِكْرِمَةُ يَرْوِيهِ عَنِ ابْنِ عَبَّاسٍ

عَنِ النَّبِيِّ ﷺ يَعْنِي مَا ذَكَرْنَاهُ  

قَالَ الشَّافِعِيُّ وَبِهَذَا نَأْخُذُ يُرْجَمُ اللُّوطِيُّ مُحْصَنًا كَانَ أَوْ غَيْرَ مُحْصَنٍ وَهَذَا قَوْلُ ابْنِ عَبَّاسٍ۔ قَالَ وَسَعِيدُ بْنُ الْمُسَيِّبِ يَقُولُ السُّنَّةُ أَنْ يُرْجَمَ اللُّوطِيُّ أُحْصِنَ أَوْ لَمْ يُحْصِنْ۔ وَعِكْرِمَةُ يَرْوِيهِ عَنِ ابْنِ عَبَّاسٍ عَنِ النَّبِيِّ ﷺ يَعْنِي مَا ذَكَرْنَاهُ