Answered by Randy Alcorn
In Revelation 22, those who are outside the city mean those who are outside the city in Hell. It doesn't mean they are sitting peering into the gates of the city, and somehow real close to it. It doesn't say immediately outside. It just means they have no access to it. However, at the end of Rev. 21 it speaks of how the gates will not be shut because people will enter. The kings of the nations of the Earth will access it. There will be saved people on the New Earth who are outside the city gates and will be entering the city gates and that is why they are opened. It is saved people who have come into the gates of the New Jerusalem and will depart from and go through the gates to the New Earth. So Revelation 22 and Revelation 21 are speaking of the gates in two different ways. They are not contradictory. Revelation 22 has a more symbolic meaning. It's speaking of the saved, those who are in the New Jerusalem (and/or have access to the New Jerusalem) where the throne of Christ is.
