header php code example
Example 1: php header location
<?php
header("Location: https://example.com");
?>
Example 2: header php
<html>
<?php
header('Location: http://www.example.com/');
exit;
?>
Example 3: header php redirect
<?php
header('Location: http://www.aaaa/index.php');
exit();
?>
<?php
header('Location: http://www.aaaa/index.php', true, 301);
exit();
?>
// or a meta in html header (if html generation is initiated)
<head>
<meta http-equiv="Location" content="http://www.aaaa/index.php">
</head>
// or waits 15s before redirection
<head>
<meta http-equiv="refresh" content="15;URL=http://www.aaaa/index.php">
</head>
// or via javascript
<script>
window.location.replace('http://www.aaaa/index.php');
</script>
Example 4: php redirect
header("Location: http://example.com/myOtherPage.php");
die();
Example 5: header location php
<?php
$url = "https://example.com";
header("Location: $url");
?>
Example 6: header location in php
/*
This will just redirect you to example.com
*/
<?php
$url = "https://example.com";
header("Location: $url");
exit;
?>
/* I hope it will help you. Namaste */