There are all kinds of products like two-sided carpet tape and rug anchors. Since they are sticky on both sides, some will get on your carpet. They're still considered safe, and won't cause damage.
Of course you could go overboard and grab a staple gun. I wouldn't recommend it though.