PHPSuperBlog.com

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.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Similar Posts:

Leave a comment