1<?php
2// This will just redirect you to example.com
3header("Location: https://example.com");
4?>
1<?php
2// This will just redirect you to example.com
3$url = "https://example.com";
4header("Location: $url");
5?>
1<?php
2/*
3 This will redirect to facebook.com
4*/
5$url = "https://facebook.com.com";
6header("Location: $url");
7exit;
8?>
1
2<html>
3<?php
4/* This will give an error. Note the output
5 * above, which is before the header() call */
6header('Location: http://www.example.com/');
7exit;
8?>
9
10
1header ( string $header [, bool $replace = TRUE [, int $http_response_code ]] ) : void