Fixed login glitch with routes and rewriting