From what Brett Devereaux writes, this doesn't happen historically (except in very rare occasions); that's a modern misconception.
Anyway archers should in some situations be able to shoot over their melee comrades, probably not (or with the risk of friendly fire) on the first rank of enemy soldiers engaged in melee, but on the rear ranks. And of course also on the first rank while they charge and are not already engaged in melee.
Also if we want to have ancient battles and not napoleonian ones with swords and arrows, we probably should take kiting into account : yes, missiles can shoot quite far, but without any discernible impact on armored troops.
Only at close range (where an enemy charge can wreak havoc to them too) can they be actually effective. The more armored the enemy is, the closest the range of effectiveness.
That would make for very interesting tactical decisions, and make melee troops the kings of battles, as it was historically (while still allowing missile-heavy tactics like the Persians used, but only if done well, and prone to awful failures if done badly, as the Persians learned at Marathon and Plateia, or against the 10 000).