This Homemade Fruit Fly Trap is the best way to get rid of fruit flies in your home out of all of the methods that we tried. It's easy to make and cost almost nothing to make!
Secure a plastic wrap over the top and secure, if necessary, with a rubber band.
Poke small holes in the top of the plastic wrap (with a toothpick, the sharp end of a knife, or something like that).
Notes
The flies are attracted to the fermenting fruit. They climb through the holes but can't get out.The soap should aid in preventing them from getting out and they die in the trap.Note that the original post instructed people to let the fruit flies out of the trap outdoors after catching them, but some readers pointed out that this would only serve to make the fruit fly problem worse. After doing some research, I realized what a huge problem the fruit fly population is and so I changed the post.