Added an extra validation to check if the redirect destination is valid.

This will validate the $redirect_to to check if it's not empty. Empty $redirect_to causes the page to exit without redirecting. With this validation, if a invalid redirect is found, we just skip it.