Before the first Hagia Sophia was built there was a pagan temple on the same spot and Constantine The Great planned to build the first church there .Same place different door!!
The first Hagia Sophia was built by the Emperor Constantius,son of Constantin the great in 360 AD and it was a basilica planned church with a timbered roof.When the emperor Arcadius exiled the patriarch of Constantinople,John Chrisostom for his open criticism of the empress Eudoxia,people got angry and arsoned the first church in 404 AD.
11 years later emperor Theodosius II built second Hagia Sophia at the same site.The second church was again basilica planned and again had a timbered roof.The second church lasted a little bit longer than the first one but its destiny was almost same with the first one.People were having some fun with chariots in Hippodrome and two factions;The Blues and The Greens , had a fight and it turned into a big riot;NIKE RIOTS.Since the rioters shouted ''NIKE,NIKE,NIKE'' repeatedly during the riot ,it is known as NIKE RIOTS or NIKA RIOTS.They arsoned many public buildings and tried to depose the emperor JUstinian I.Actually he was scared to death and about to leave the city but his wife Theodora made a speech and changed the destiny.She convinced Justinian to stay and fight instead of leaving like a coward.And Justinian send his famous and glorious general Belisarius to handle the rioters.And he did it very well, killed them all in Hippodrome in 532. But it was too late for second Hagia Sophia.
10 days after the riots Justinian started to build a new church,a much bigger one and brought the best architects and workers of the country.They completed the work in five years and ten months and the third Hagia Sophia was opened for services in 537.It was the greates church of the Eastern Roman Empire at that time and used as a church till 1453.
When the Ottoman conquered the city,as a tradition, it was converted into a mosque and was a mosque till 1935 .
It was converted into a museum by the order of Ataturk ,the founder of the Turkish Republic, and is a museum now.
It is open everyday except Monday,from 9 AM to 4 PM and the entrance fee is 20 Turkish lira.They do not accept any other currency but the credit card is ok.The present building is mostly original and in extremely good condition. At the inside of the building it is possible to see some Christian icons, islamic additions made by the Ottomans.