fixes #4555 dotCMS uses redirect 301 instead of 302

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