Fruit flies are plentiful when there is lots of refuse or garbage around your house.
Fruit flies are smaller than the average fly and are easy to spot because of their yellowish body tone and bright, red eyes. They breed in septic and sewer systems and places that have large piles of garbage or plant refuse. They also hover around ripe and old fruit and veggies. Though fruit flies like to hover around old and rotted plants, they can also be attracted to growing plants and vegetables. Fruit like to not only feed on plants, but they grow eggs in the fruit. Imagine harvesting your favorite plants only to have maggots feasting on your favorite fruits and veggies from the inside.
To get rid of fruits flies, there are organic pesticides that are known to get rid of all kinds of flies. Natural pesticides are best when getting rid of any pest to avoid harming plants and domestic animals. There are various home remedies you can use to get rid of maggots and larvae that turn into fruit flies. You can also keep the fruit fly population down by keeping your garden free of any leftover compost. Those who make large amounts of compost should not leave their compost out in the open so as not to attract unwanted insects and animals.
Fruit flies especially love to thrive in deep, rich rotting compost.
so if you do compose large amounts of plant refuse then cover it up with plastic wrap or find a way to get rid of any excess material to avoid fruit fly population growth. If you have a septic system, make sure that your tank is cleaned every month to prevent fruit fly infestation. There are various powders you can use to flush down your toilet to break down debris build-up in your septic tank.
Source of Information on Fruit Flies