added automatic redirection setup (re #151, re #215, re #218)