It was a fourth consecutive league win and clean sheet for play-off chasing City, who are sixth in the Sky Bet Championship table and very much in the thick of the promotion race.
Rangers, on the other hand, are enduring a miserable spell and suffered a third defeat in their past four games.
Diedhiou scored after 16 minutes at the Kiyan Prince Foundation Stadium, where he was a constant problem for the home defence.
Jack Hunt won a challenge against Ebere Eze near the right-hand edge of the halfway line and delivered a fine ball towards Diedhiou, who superbly headed beyond Liam Kelly and into the far corner of the net.
Keeper Kelly had earlier kept out a low shot from Diedhiou after the striker had evaded a couple of challenges and tried his luck from 20 yards out.
Rangers struggled to create chances before two came their way shortly before half-time. Grant Hall headed wide from Luke Amos' cross and Jordan Hugill sent a right-footed effort wide after being set up by Bright Osayi-Samuel.
The hosts improved after the interval and Eze shot wide before delivering a corner from which Conor Masterson went close with a far-post header.
Hugill went closest to equalising when his header from Eze's corner was cleared off the line by Nathan Baker.
The home fans' frustration was compounded by the sight of Nahki Wells coming on as a substitute for his Bristol City debut just after the hour mark.
Wells scored 14 goals this season while on loan at QPR, who wanted to sign him on a permanent deal but missed out when he was recalled by Burnley and sold to the Robins this week.
His departure left Hugill as Rangers' only viable option up front for the remainder of the campaign.
The on-loan West Ham striker worked hard but was well contained by the City defence, as was Eze.
Osayi-Samuel had some limited success, worrying the visitors' backline with his pace and directness.
However, he lacked composure in front of goal when an opportunity came his way, blasting high and wide from inside the box.
And Hugill had a late header saved at point-blank range by keeper Daniel Bentley after being found by Eze's right-wing cross.
City remained a threat on the counter-attack and Kelly produced a smart save to deny Diedhiou a second goal.