How to redirect with PHP?

Page

You can use a simple PHP script to redirect a user from the page they entered to another web page.

<?php

header(“Location:mypage.php”);

?>

The header() to send a raw HTTP header. Using header() method, you can easily transferred to the new page.

<?php

header(“Location: https://softworker.wordpress.com/”);

?>

The header() is used to send a raw HTTP specification specific header. The header() must be called before any actual output is sent. PHP’s header() function you can automatically redirect them to the new page. The header function is a PHP specific function and cannot be used outside of PHP. Note that the header function goes within the <?php ?> section and has to be placed before any HTML tags.

 

Leave a comment