Listen to your body and leave your ego at the door. Riding through illness could worsen the condition, forcing you off the bike longer than if you had taken a few days while you were sick.
Sometimes it's a no brainer. I had food poisoning last month and it put me down hard for 5 days, and off the bike for 8 days. A ride of any duration was unthinkable.
A head cold I'm now living with was too intense on days 1 and 2 to ride. On Day 3 I did a light intensity ride, maybe 1/2 hour, and felt fine. But today, day 4, I felt well enough for a 1 hour singletrack hammerfest. Tomorrow I'll be back to my usual distance and intensity.