Redirect page using PHP function header()
In some cases, you might like to redirect the user to another page when the user enters a certain page, example like when the website is under maintenance and you might like to redirect the user once they reach the home page to a page saying that the website is under maintenance. To redirect to another page when the page loads, there is a function in PHP could do the job. It is the header() function and the way to for redirecting a page is like this:
I have created a PHP file named “redirect.php”:
<?php header('Location: http://www.phpsuperblog.com'); ?>
In the case above, the header function is called to redirect the page “http://www.phpsuperblog.com” when that page “redirect.php” loads.
Replace the URL with the one whatever you like to redirect to.
Similar Posts:
- Refresh page with PHP function header()
- Check ip address of host or website with PHP function and HTML form
- Copy one table’s field records into another table’s field in MySQL database with PHP
- Insert all array elements into MySQL database table’s different fields
- Display UTF8 encoding records such as Chinese or Asian languages from MySQL database with PHP





