Settings
Good lighting is important. You don't want the photo to be too light, because you won't see the colours of the rainbow. In fact, the colours become slightly brighter when the photo is dark. But because of this, the landscape may be underexposed. Which precise settings of aperture, shutter speed and ISO you need, depends on many factors. It is always advisable to operate the camera manually. This gives you optimal control over your image. Always check your surroundings so you can adjust your settings under the weather and light circumstances. With an ISO around 200, aperture between f/8 and f/11 and a shutter speed smaller than 100 you’ll often have a range of settings that will create the best photos.
You can use a polarizing filter to make the rainbow appear even stronger in the image. Of course, the other way around is also possible, and you can use a polarizing filter to make the rainbow disappear. So keep this in mind while photographing so you use or remove the polarizing filter.
Another thing that can be very handy while photographing a rainbow is a tripod. By using a tripod, you are assured of a steady and sharp image.