Pain during sex

I have noticed that whenever I have sex (from the back) I get shooting pain in my groin, which isn't a nice feeling. If I straighten my legs then the pain gets worse but if I bend them slightly or move to 1 side then it doesn't hurt as much. Is this normal?