Crimson Longinus
Legend
I don't think the base concept of ranger i.e. outdoorsy wilderness guy, really requires magic. It is traditionally given magic in D&D, but in every edition people ask for a magicless ranger.My problem with the Rogue is as a class it is not magical enough to fill what I like about the Ranger. You can get some magic options through Rogue subclasses, but all Rangers get spells (lots of them with Primal Awareness), Favored Foe and Nature's Veil and they can get more magical stuff beyond that through their subclasses.
If we want to put it into a subclass of another class I think a Sorcerer works best, although you would be trading some Ranger abilities for spells that cover similar ground. Artificer could work too I think. Paladin and Cleric might work too, but they have a lot of extra baggage they bring to the table.
And we already have a full dedicated nature magic class in the druid.