gall bladder? Does the pain bother you more often after a fatty meal?
Only things that really favor the right side are heart and liver.
When my lung collapsed, it hurt way more in my back area than right under the ribs. Hopefully that's not your problem because. that. sucked.
Is it under the ribs or in them? I get muscle pain in my ribs from time to time. Sometimes I can "pop" the ribs and it feels much better when I do. I hate when the pain is so much from that though to the point I have trouble breathing.