If only the area directly below the flange is rotted you can install a two piece steel closet flange support.
Installing toilet flange on wood floor.
There are two options this step.
Next install a new wax ring.
It goes under the flange and transfers the load of the flange and toilet and you out onto more solid surrounding wood.
Rest the toilet bowl on its side place it on a towel or cloth to protect the floor and attach the replacement wax ring to the bottom of the bowl this technique helps ensure the ring is in the proper position when placing the toilet over the flange.