This is quite an interesting question because it makes us think of the various meanings of be. And what guides us in understanding what meaning be takes, is what preposition is used.
In indicates a position inside one area.
To indicates a movement, you go from one area to another area.
She has been to York.
indicates a movement from a point outside the City of York to the City of York (whatever point in the city).
She has been in York.
indicates that she was inside the area called "York". It does not suggest a movement.
She has been to York means that at one point in her life she went to York, the main idea of the sentence is in the trip to York.
She has been in York means that at one time in her life - it could be a very long time, she was in York she stayed there, it says nothing about taking a trip to York.
This difference in meaning of the verb be does not exist in all tenses, we have seen it exists in the present perfect but it does not exist in the past, in the past be can only have the meaning of "staying" in one place.
- "She was in London" is correct.
"She was to London" is impossible.
From that point we could ask if when in the present perfect be is synonym of go, since go also indicates a movement from one place to another?
The answer is no. In the present perfect "she has been" and "she has gone" have different meanings.
She has been to York.
means at one point in her life she travelled to York (and as a consequence she now knows this city). When I say these words "she" might very well be standing next to me thousands of miles away from York.
She has gone to York.
means she is not with me when I say these words because she has travelled to York is she is in York at he moment.