Fixed #23583 -- More selectively ignored static/media roots

Fixed a regression introduced by 28efafa24c.
Thanks Michal Čihař for the report and initial patch.
Good idea, it might even be the right thing to do for Windows compatibility.