Look straight ahead while walking, not down at the ground. Stand straight up instead of slumping or letting your body collapse. Give the impression of walking with a purpose. This confidence projects to people that you will not be a victim. Attackers will look past you because they don't think you are an easy target.
Rapist seem to seek out the shy and the meek.
Those with a lot of confidence seem to carry themselves in a more alert, upright manner. I think these people are victimized less often. Always be aware of things around you. Listen to people close behind you and estimate their distance and walking pace. Carry mace or pepper spray.