fixes #5589 htmlpage redirect not working with external links

Fixed the issue and pushed the code for review, please check it.