How To Create A PHP Header Redirect
Redirecting to another website
To set up a simple redirect in PHP you will need to create a header() function. Simply create an index.php file in the location you want to redirect from with the following line of code:
< ?php header(“Location: https://URL-YOU-WANT-TO-REDIRECT-TOO/”); ?>
This will now redirect to the website location you typed.
Redirecting to another page or directory
You can also create a file that links internally on your file manager.
<?php header(“Location: anotherDirectory/anotherFile.php”); ?>
When linking to an internal file it doesn’t have to match a .php extension, It can be the following programs python, HTML, PHP, Perl, CGI and compiled CGI programs.