When Solomon brought the ark into the Temple and said, "Lift up 3'our heads, O ye gates! and the King of glory shall come in," the gates were ready to fall upon him and crush his head, and they would have done so if he had not said at once, " The Lord of hosts, He is the King of glory" (Ps. xxiv. 9, 10). The Holy One — blessed be He! — ■ then said to the gates, " Since ye have thus honored Me, by your lives! when I destroy My Temple, no man shall have dominion over you! " This was to inform us that while all the vessels of the Temple were carried into captivity, the gates of the Temple were stored away on the very spot where they were erected; for it is said (Lam. ii. 9), " Her gates are sunk into the ground."
The Temple Gates That Refused to Open for Solomon
Midrash Devarim Rabbah 15 (Hebraic Literature, 1901)