When is it appropriate to end a sentence in a preposition?
Solution 1:
A preposition is a perfectly reasonable word to end a sentence with. Admonitions against doing so are not something anyone needs pay heed to. It's the kind of made-up rule that is not based on the reality of the language and anguish over doing it is something no writer need suffer from. And if you don't believe me, look it up.
Solution 2:
There is just simply no such rule in English.
Now, in the seventeenth century, Dryden complained about it, because he wanted to write a bit about how he was a much better writer than Shakespeare and Johnson, and the best he could come up with is that Shakespeare and Johnson hadn't followed a rule about preposition position that existed in Latin, but had never existed in English.
On the one hand, that at least is a bit better than the nonsense about split infinitives — where people prohibit something in English not because it's forbidden in Latin but because it's actually impossible in it. On the other hand, it's still pretty stupid.
Ironically, English is overall a much stricter language than Latin about word order, and it's precisely because of this that in Latin a preposition not only can't appear at the end of a sentence, but can not appear after its object (that is indeed the etymology of the word — pre- + position). The idea that this means anything in English only follows if we allow that "means the idea in English anything" is a well-written clause (hey, the preposition's in the right place!).
Following Dryden, some more people followed suit. Now, some would say that it is often more graceful to place the preposition before the object, or that it's a good idea to make sure that the preposition isn't so separated from the words it most closely relates to as to cause confusion. I'll agree with the latter and allow the former as true much of the time, though it can be the graceless option other times.
But some went further and said that there was some magical rule against prepositions.
You might think that today we could easily counter such foolishness by pointing out Shakespeare and the King James Bible use it, and you don't have to believe in biblical infallibility — or indeed believe any of it to any degree — to believe the King James is as infallible as can be when it comes to grammar, with Shakespeare as grammar made flesh. (And Shakespeare clearly isn't infallible in other ways — his geography is hilariously bad and his history allowed clocks to chime in Ancient Rome, but it's bad geography and history, beautifully expressed).
But that was a different era, and such ramblers actually cited Shakespeare as an example of bad English, much as people today may complain that an MTV host saying "yo! We gonna pimp yo' ride sweeeeet!" is a bad example to children learning English today.
Thankfully, Shakespeare won the popularity contest, and we can enjoy his plays in any city in the world, and only rarely are such pontificators of invented grammar rules something we have to put up with.