Earwigs are attracted to decaying organic matter and moist, dark locations. You may be able to trap them by placing boards on the soil near the foundation of the home. They'll tend to collect under the boards, and you can squish the collected earwigs. It also helps caulk any cracks and crevices through which they might enter the home, especially around windows and door threshholds. You can sprinkle diatomaceous earth on the ground where they are likely to crawl or spray botanical insecticides such as rotenone or pyrethrum in the cracks and crevices where they may enter the home.