Rug Pads
Sometimes one can find some really funny advice online dealing with all sorts of problems. I would suggest considering the source of this advice as well as just going with what makes sense. A lot of faulty advice has problems that can be spotted without to much expertise.
While that would probably hold the rug in place on your hardwood floor I would not recommend this. This can seriously damage your rug. Gluing things to your rug is generally a bad idea and only anchoring the corners may cause the rug to pile up in-between and present an even grater tripping risk.
Happily the problem of a slippery rug (something one should indeed be careful about) can easily be handled with a rug pad. They are rather common and cheap. These pads can not only prevent the slipping but also increase the durability of your rugs. For most situations you really don’t need a fancy rug pad the ones that home depot or other home improvement stores sell work quite well and can easily be cut to the size of your rug.