reoccurring UTI

I had a UTI that got really bad and spread to my kidneys nearly hospitalising me. I got rid of it but it is always coming back and whenever I'm stressed my kidneys flare up and causes really bad back pain. Why is this?