To humanely prevent ants entering a house, give them a more convenient source of sugar outside the house.
Ants do not commonly infest houses throughout the year in the UK but they do forage into houses sometimes. The trail of ants is not normally a serious problem but can nevertheless be irritating, unsightly and/or unhygienic. I don't like it because of the difficulty not squashing the poor little creatures whilst I walk around and because I find ants in my food off-putting.
The traditional cures involve killing the whole nest by pouring poison or boiling water into it or by using a slow acting poison (borax) mixed with food (sugar) that worker ants will carry back and distribute. These seemed excessive to me. I had no objection to ants, only to them coming into my house - particularly as the room they mainly entered was my kitchen.
In approximately 1997, I thought anent redirecting the ants instead. This idea was inspired by reading of Richard Feynman's casual experiments in redirecting ant columns by moving individual ants until the pheromone trail was changed. I was less subtle, I selectively squashed individual ants that were going in directions I did not want them to. I reasoned that, for ants, the ant colony is effectively the independent creature and the individual ants were like cells of the colony so squashing a few ants would be much less cruel than poisoning the whole colony.
It did not work. I thought maybe that the learning process that way was too slow so that the lost ants would not be associated with danger in the direction of my kitchen. It tried increasing it to laying barriers of contact poison (permethrin) across the thresholds to deter all ants from entering. That did not work either.
Obviously the ant colony desired something in my kitchen that it would sacrifice dozens of ants to get it. As all the endpoints of the column were sugar sources, the main one being the lid of a fruit cordial bottle, I hypothesised that the ants were desperate for sugar. Hence I thought that if they had a safer source of sugar they might not bother with my kitchen. I gave them such a source by dropping a dessertspoonful of golden syrup on their route between the nest and my house.
It worked! Very soon there were lots of ants at the syrup blob and none in my kitchen. Every time I have had an ant infestation since then, I've repeated the procedure of paying off the ants with a dollop of sugar syrup and the ants problem has been cured.
I did not publishing it on my website though because I thought that the method would probably not work in warmer countries where ants are more numerous. In my area of Britain, ants are mostly small (about 3 mm long) harmless black ones which I have only found entering houses in search of food shortly before swarming time. However, an answerer to a question anent using pet anteaters to kill ants mentioned that this method also worked in Hong Kong (Miller 2004)! As it reportedly even works in the hot & humid insect favouring climate of Hong Kong, it seemed that it was worth publishing after all. Even though it the solution is therefore already on the WWW in the New Scientist's archive, that article is not something that is easy to find by searching (unless one knew that it already existed). Indeed, using Google to search for 'humane' & 'ant' mainly leads to sites selling ant poison! I am adding my version of the advice here in the hope that it will reduce unnecessary cruelty to some ant colonies (and help some people who are fed up with ants in their houses).
J. Miller, 2004, 'The Last Word: The Natural Assassin', New Scientist, 2004/7/17, 2456, p. 85.