All "Missiles" types weapons (High Explosives, EMP, Nukes, and Mines) should be "intelligent" in the sense that they blow up ONLY against enemy ships. For your own ships, if they "hit", the missile just won't blow up at all (maybe bounce) (maybe with, if implemented, some physical collision damage on both the missile and the ship part that was hit).
Just like for ammo based weapons, physical impacts should always have some amount of penetration through shields.