improve redirect url detection
Merge remote-tracking branch 'remotes/wuman/master'