The best way to do it is to core the rope. You should be able to fray one end enough to see that there is a "core" of rope running through the center. You should be able to pull that center completely out leaving you with basically one really long Chinese finger trap. This is the part you'll use, discard the core.
Now, to make the ends look nice, you can use a sharpie or pen to tuck the frays inside of the rope. Once they're tucked in and look nice, dab some white glue inside and roll the ends around to evenly spread the glue. Let it dry for a while and you're good to go!