Is there any way to have the phone NOT ring through speakers when headphones are in?

I often use my phone with headphones - especially with travel - but when i receive a call, text, email, etc., while using headphones, it rings both through the headphones and through the normal speakers.

Is there a way to disable this, so that it will ONLY ring through the headphones?