Fixes #325 - smart redirects