How do you not get rabies?

If you mean your pets, you can get vaccinations to prevent it. If you mean avoiding getting it yourself, all I can tell you is to not let an animal with rabies bite or scratch you so the saliva doesn't get into your blood system.