Verse 27: (Num. 31:22, 26) Only the cattle and the spoil of that city Israel took for a prey unto themselves, according unto the word of the LORD which he (Josh. 8:2) commanded Joshua.
Verse 28: And Joshua burnt Ai, and made it (Deut. 13:16) an heap for ever, even a desolation unto this day.
[He made it an everlasting mound] In the place where the city had been he place a heap of stones (Grotius). A mound, understanding, of stones (Vatablus). Objection: But the city of Ai is found in Nehemiah 11:31, where it is called עַיָּה/Aija. [Concerning which see on Joshua 7:2.] Therefore, it did not remained destroyed forever. Response: עוֹלָם often signifies, not an everlasting, but a long time. And the Talmudists note a threefold עוֹלָם: 1. from the beginning of the world to Messiah; 2. the entire time of Messiah, and they extend that unto the resurrection of the dead; 3. from the resurrection unto eternity. Now, it was a long time, namely, one thousand and one hundred years, from Joshua to Nehemiah (Masius), under whom perhaps this city was restored (Bonfrerius). Or, that Ai in Nehemiah 11 was not built on the site of the old city, but on land nearby. But you will say, If Ai was inhabited in the age of Ezra, how does it follow, unto the present day? Therefore, neither Ezra, nor any contemporary of him, is the author of those words. Response: But what would prevent that that city was desolate until the return of Ezra, but then at length it was rebuilt (Masius)?
For ever, or, for a long time, as that word oft signifies, as Genesis 6:3; Isaiah 42:14; for that it was after some ages rebuilt, may seem from Nehemiah 11:31, unless that were another city built near the former, there being some little difference in the name also.
Verse 29: (Josh. 10:26; Ps. 107:40; 110:5) And the king of Ai he hanged on a tree until eventide: (Deut. 21:23; Josh. 10:27) and as soon as the sun was down, Joshua commanded that they should take his carcase down from the tree, and cast it at the entering of the gate of the city, and raise thereon a great heap of stones, that remaineth unto this day.
[He hanged the king] He crucified him, in the Roman manner. Thus a great many interpreters (Malvenda). It was a shameful punishment, with which, nevertheless, the King of Ai is deservedly punished. Greater punishment was due to the Princes of the Canaanites, who were so far from punishing the sins of their own that rather they went before them by their depraved example and license for sinning (Menochius). He hanged the king, but he had been killed previously. For hanging was not a punishment in that context, but bodies were exposed in this manner for a display, as it was said on Deuteronomy 21:22. So also interpret Joshua 10:26 (Grotius).
And the king of Ai he hanged on a tree: He dealt more severely with the kings of Canaan than with the people, partly because the abominable wickedness of that people was not restrained and punished, (as it should have been,) but countenanced and encouraged by their evil examples and administrations; and partly because they were the principal authors of the destruction of their own people, by engaging them in an obstinate opposition against the Israelites.
[Until evening] According to the law of Deuteronomy 21:22, 23 (Masius).
That they should take his carcass down from the tree, according to God’s command in that case, Deuteronomy 21:22, 23.
[In the very entrance of the city, אֶל־פֶּ֙תַח֙ שַׁ֣עַר הָעִ֔יר] Towards the doorway (into the entrance [Syriac]) of the gate of the city (Montanus, Jonathan); near the gate of the city (Arabic, Junius and Tremellius); into the pit (Septuagint). Either with letters transposed they read פַּחַת/pit in the place of פֶּתַח/entrance; or they wanted to accommodate the present place to the burial of Absalom, 2 Samuel 18:17, where there is mention of a pit (Masius). Into a certain pit, which was next to the gate of the city (Vatablus). Perhaps into the ditch of the city walls (Malvenda). Or, towards the gate: whether because that place appeared more suitable for the raising of that monument (Malvenda); or because in that place many wicked judgment had often been executed; or because, with the whole city just now burning with fire, he was not able to be brought within the walls (Masius).
[With a heap of stones piled over him] It was not hastily heaped up; but with care and order this mound was composed of stones, and the structure was raised as a monument to posterity (Malvenda out of Masius). I think that the King was first covered with soil, and then this monument was set up. וַיָּקִימוּ, and they should raise, signifies this (Masius).
He chose the entering of the gate of the city, either as most commodious, now especially when all the city within the gate was already turned into a heap of stones and rubbish; or because this was the usual place of judgment, and therefore proper to bear the monument of God’s just sentence against him, not without reflection upon that injustice which he had been guilty of in that place.
 Hebrew: רַ֣ק הַבְּהֵמָ֗ה וּשְׁלַל֙ הָעִ֣יר הַהִ֔יא בָּזְז֥וּ לָהֶ֖ם יִשְׂרָאֵ֑ל כִּדְבַ֣ר יְהוָ֔ה אֲשֶׁ֥ר צִוָּ֖ה אֶת־יְהוֹשֻֽׁעַ׃
 Hebrew: וַיִּשְׂרֹ֥ף יְהוֹשֻׁ֖עַ אֶת־הָעָ֑י וַיְשִׂימֶ֤הָ תֵּל־עוֹלָם֙ שְׁמָמָ֔ה עַ֖ד הַיּ֥וֹם הַזֶּֽה׃
 Genesis 6:3: “And the Lord said, My spirit shall not strive with man forever לֹֽא־יָד֙וֹן) רוּחִ֤י בָֽאָדָם֙ לְעֹלָ֔ם), for that he also is flesh: yet his days shall be an hundred and twenty years.”
 Isaiah 42:14: “I have long time (מֵעוֹלָם) holden my peace; I have been still, and refrained myself: now will I cry like a travailing woman; I will destroy and devour at once.”
 Hebrew: וְאֶת־מֶ֧לֶךְ הָעַ֛י תָּלָ֥ה עַל־הָעֵ֖ץ עַד־עֵ֣ת הָעָ֑רֶב וּכְב֣וֹא הַשֶּׁמֶשׁ֩ צִוָּ֙ה יְהוֹשֻׁ֜עַ וַיֹּרִ֧ידוּ אֶת־נִבְלָת֣וֹ מִן־הָעֵ֗ץ וַיַּשְׁלִ֤יכוּ אוֹתָהּ֙ אֶל־פֶּ֙תַח֙ שַׁ֣עַר הָעִ֔יר וַיָּקִ֤ימוּ עָלָיו֙ גַּל־אֲבָנִ֣ים גָּד֔וֹל עַ֖ד הַיּ֥וֹם הַזֶּֽה׃
 2 Samuel 18:17: “And they took Absalom, and cast him into a great pitאֶל־הַפַּ֣חַת) הַגָּד֔וֹל) in the wood, and laid a very great heap of stones upon him: and all Israel fled every one to his tent.”