Redirection in PHP can be done using the header() function. To setup a simple redirect, simply create an index.php file in the directory you wish to redirect from with the following content:
< ?php header("Location: http://www.redirect.to.url.com/"); ?>Where 'http://www.redirect.to.url.com/' is the URL you wish the users to be redirected too. This can also be a file, like so:
<?php header("Location: anotherDirectory/anotherFile.php"); ?>Files can be of any type including but not limited to HTML, python, php, cgi, perl, and compiled cgi programs.
Sunday, November 24, 2019
How To Code a PHP Redirect - PHP Header Redirect
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment