A sliding throw rug is one of my pet peeves. I have tried those rubber liners, that you put under the rug, but they don’t work well or very long. I came up with two solutions.
Throw Rug on Carpet
I attached several “Velcro” dots, the hook side, to the underside of my throw rug. The hook catches the loops of the carpet.
Throw Rug on Wood Floor
I have a small throw rug that I wanted by the back door, next to a matching 5’ X 8’ rug. I got out my upholstery needle and sewed them together with matching thread.
If all else fails, I try to anchor the rug under a piece of furniture.