Simple, really.

Do  not build in forests where there will be wildfires; do not build on flood plains.