header()
FunctionYou can simply use the PHP header()
function to redirect a user to a different page.
The PHP code in the following example will redirect the user from the page in which it is placed to the URL http://www.example.com/another-page.php
. You can also specify relative URLs.
<?php
header("Location: http://www.example.com/another-page.php");
exit();
?>
If you want to redirect the users from old page to a new page on a permanent basis then also mention HTTP response code in the header()
function as shown in the following example, so that search engines transfer "page rank" from the old page to the new page.
<?php
// 301 Moved Permanently
header("Location: http://www.example.com/another-page.php", true, 301);
exit();
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Laravel 8 - Paypal Payment Gateway Integration
Laravel 8 PayPal Integration is the impo...Laravel 8 - Excel and CSV Import Export to Database using maatwebsite/excel with Example.
Excel file import-export to the database...Laravel 8 Firebase Phone Number OTP Authentication
Laravel 8 mobile number OTP authenticati...Laravel8 - Validation Required if Another Field is Empty
In this article, I will share with you h...How to run Python 3 Script in Laravel 7?
Hi, Artisan In this article i will sh...