In my shop fruit flies are always a concern, especially during fruit season. People bring fresh fruit into my shop to make wine. Even if the fruit is clean, the crushing and pressing of the fruit smells good and the flies come looking.
Fruit Flies like ripe fruit.
Ripe fruit contain sugar, as the fruit starts to break down the natural yeast starts to convert the sugar to alcohol, a group of bacteria (called “Acetobacter”) converts the alcohol portion to acetic acid (vinegar).
Fruit Flies carry acetobacter.
Acetobacter must know that fruit flies will take them to where they need to go, or the fruit flies want to make vinegar so bring them along to the party.
Your standard trap is a bowl, cup, jar, container with 2cm or more, of wine or cider in the bottom and a drop of soap. To make it more effective a lid or cover (plastic wrap) with some holes poked in it (~2mm ) is placed on the container. A dark container is better, they breed in dark places.
When baiting a trap you can use what ever is closest to hand, fruit juice, fermenting fruit juice, wine, cider, apple cider vinegar. Think what they came for in the first place.
Put a small drop of unscented or not strong scented soap in the liquid so the surface tension is broken, you don't need much. If you don't they will lay eggs at the edge and you will have a breeding program instead (step 1 to making a vinegar mother).
Fruit Flies do NOT like;
Dry environments. Keep your drains covered and your counters clean & dry. No wet dish cloths.
Moving air. Leaving a fan on to keep the air moving will reduce the rooms appeal.
Temperature. I find they prefer the temperature to be over 20C and when I keep my fermentation room at 18C I have very few in the room.
So....In Fruit Fly season don't give them a reason to hang out. You can't keep them out of the house as they will follow you in any time you open the door, but you can keep it under control. Make it so the best thing around is the trap so any strays go there and don't get a chance to breed.
To keep them under control in my shop;
Floors, walls are kept clean & equipment cleaned and dried every day. Drains are covered after hours.
Fruit Fly Traps are set in every room.
Garbage taken outside.
In the morning I take out my hand held vacuum cleaner. If you have a bag in the vacuum you will have to block the hose when you turn it off so they don't fly back out. (I removed the bag & filter so the impeller gets them, after 12 years it is time to clean the impellers to improve performance again) They like to sit along the edge of the most things, door, window frame, shelf, bucket handles, & the damp cleaning cloths that were hung up to dry. Start at one edge and slowly work along and as soon as they let go they get sucked up. If you go too fast and they take flight before the vacuum is close enough you will spend more time chasing them. Better wait for them to settle again.
By doing this I have fewer Fruit Flies at work than I do at home in the kitchen.
Remember, keep Fruit Flies out of wine making unless you want to make vinegar.
Life Cycle Picture from http://www.discoveryandinnovation.com/BIOL202/not...