Greetings everyone, Today our topic is redirect in PHP. In this article we will learn how to redirect from home page to about page in PHP so, let’s go started.
If you want to go another page you can easily use header() this is built-in function of PHP which do use to send the raw HTTP header to the users.
HTTP stand for (Hyper Text Transfer Protocol) now I want to go home page to about page I use to URL will go another page see the example below.
<?php header("Location: https://www.wholeblogs.com"); exist(); ?>
Now I reached at the wholeblogs.com so, redirect the user from chrome to home page on perpetual base and then it also mentions the HTTP response code into header( ) function such as seen the example below the seo stand for the Search Engine Optimization throw “page rank” from the home page to about page and If you want to see more example this link TutorialRepublic.
<?php // 301 Moved Permanently header("Location: http://www.example.com/another-page.php", true, 301); exit( ); ?>
Read more: 3 Ways to Add CSS link into HTML