Please note, this is a STATIC archive of website technosmarter.com from 20 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
 

PHP: Redirection


Redirection is the operation in PHP, where users jump from one page to another.

We use the header() function to redirect from one page to another. In the header () function, we pass the page name or URL path. If a user clicks on the page, he gets redirected to another page.

Definition of Redirection operation in PHP

Redirection operation is used to jump one page to another web page.
In simple words, if you create a page (PHP-redirect-operation.php) and want to redirect this page to another (PHP-profile.php), you have to need to use header() function. You need to complete redirection one page to another. That is known as PHP redirection.

Example of redirection operation

To redirect a page, we can use some time like 5 to 10 seconds.
5 to 10 second means ,the page will redirect another page after 5 to 10 seconds.

A simple example of a redirect operation using the header() function .

Example

<?php
header("location:https://technosmarter.com");
?>


header() function is used to send a raw HTTP header.


Location – Where you want to jump ..(Web page location, page name etc)


Redirection operation by giving time

Now we will create a time duration redirection one page to another.

Example

<?php
header("refresh:5;  url=https://technosmarter.com");
echo "Redirecting.....";
?>
Run

refresh:5 – The page will redirect after 5 seconds on another page.


Please Share

Recommended Posts:-