Redirect with errors using custom url

Redirection was working with error, I created a parameter if the developer wants it to happen