redirect php page code example

Example 1: php redirect

//PHP redirect
header("Location: https://www.codegrepper.com/my-redirect-page.php");
die();

Example 2: how to redirect with php

<?php
  header("Location: (redirect url)");
?>

Example 3: php redirect to url

header("Location: http://example.com/myOtherPage.php");
die();

Example 4: php redirect

header("Location: http://example.com");
die();

Example 5: header location php

<?php
// This will just redirect you to example.com
$url = "https://example.com";
header("Location: $url");  
?>

Example 6: how to redirect to another page in php

<?php header("Location: anotherDirectory/anotherFile.php"); ?>

Tags:

Php Example