A portal does not send people between two places, as a Teleport or a Gate does. A portal reshapes space to make two circles the same place.
A portal does not have two parts, or even one part that is in two places. There is no longer any fact of the matter about the former two places being distinct. Any effect that relies on the distance between two points will work through a portal as if through normal space, because it is.
A portal can be dispelled by targeting the area containing it. It cannot, itself, be targeted, because it is not an object, or even a thing. It is just - an area of space, which happens to have a complicated spatial metric around it.
To make an interplanar portal, Ahmose found the part of the spellform which targeted the effect, and - disabled it. At first this spell did nothing, but with enough prodding he made the spellform say, in effect, target any place which cannot be specified by the normal mechanism. Why this made an interplanar portal, and not e.g. one leading outside the one-mile range, is not something Ahmose can say; but he knows, now, that it did so.
He doesn't know how to make it target the place he's thinking of, instead of a place he's looking at. (He tried closing his eyes and thinking various thoughts; the spell failed.) But he can change the targeting component in every way that still stabilizes, and - see what happens.