Here's an example PHP code to redirect a URL from a file

// Read the URL from a file
$redirect_url = file_get_contents('redirect.txt');

// Perform the redirect
header('Location: '.$redirect_url);

In this example, the URL to redirect to is stored in a file called "redirect.txt". The script reads the URL from the file using the file_get_contents() function and stores it in the $redirect_url variable. Then, it uses the header() function to perform the redirect to the URL stored in $redirect_url. The exit statement is used to stop the script execution after the redirect.

Note that in order for the redirect to work, the header() function must be called before any output is sent to the browser.

Related Articles

- All From ChatGPT