How can the code be modified to prevent the "ERR_TOO_MANY_REDIRECTS" error?
The "ERR_TOO_MANY_REDIRECTS" error occurs when a webpage enters an infinite loop of redirects. To prevent this error, you can add a condition to check if the current URL matches the redirect URL before performing the redirect. This ensures that the redirect is only executed once.
if ($_SERVER['REQUEST_URI'] != '/redirected-page.php') {
header('Location: /redirected-page.php');
exit();
}