can we use a header function to redirect the user to another page

PHP
//PHP redirect
header("Location: https://www.codegrepper.com/my-redirect-page.php");
die();
header("Location: http://example.com/redirect_page.php");
die(); //Force the script to quit, or you would raise an error...
Source

Also in PHP: