Redirection is a feature to redirect a user from the current location to the new location, as an example is to redirect you from https://kodekativ.co
to https://id.kodekativ.co
.
To implement a redirection feature in PHP, we can use header()
function.
<?php
header("Location: https://id.kodekativ.co");
exit();
?>
If you want to tell browser that the redirection is permanent which is to redirect user a new website page from unused old page, you have to add more parameters in header()
function:
<?php
// 301 Moved Permanently
header("Location: https://id.kodekativ.co", true, 301);
exit();
?>
Source: php.net - header function