redirection fix for dev and test environments

Davide Di Carlo, have a look at this pull request and see if it works fine on your local environment