أَخْبَرَنَا الشَّافِعِيُّ رَضِيَ اللَّهُ عَنْهُ، قَالَ: أَخْبَرَنَا مَالِكٌ، عَنْ رَبِيعَةَ بْنِ أَبِي عَبْدِ الرَّحْمَنِ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ رَضِيَ اللَّهُ عَنْهُ: أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ: "وَنَهَيْتُكُمْ عَنْ زِيَارَةِ الْقُبُورِ فَزُورُوهَا، وَلَا تَقُولُوا هُجْرًا" .
It is narrated from Abu Sa'id Khudri (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: I used to forbid you from visiting graves, but now you may visit them, and do not say anything wrong.