Use a non-slip rug pad underlay to prevent a rectangular rug from sliding on a hard surface. These pads are synthetic rubber designed to keep rugs from moving around on hard floors.
They create a little cushion between the rug and the floor, which gives it some traction.
Another tip is to place furniture around the rug's edges to help hold it down.
But if all else fails and your rug is still a slippery little devil, consider using double-sided tape or rug grippers to secure it to the floor.