1<?php
2// This will just redirect you to example.com
3header("Location: https://example.com");
4?>
1<?php
2 header('Location: http://www.aaaa/index.php');
3 exit(); // useless to let script running
4?>
5
6<?php
7 // permanent redirection (default is 302, 303 for most robots)
8 header('Location: http://www.aaaa/index.php', true, 301);
9 exit(); // useless to let script running
10?>
11
12// or a meta in html header (if html generation is initiated)
13<head>
14 <meta http-equiv="Location" content="http://www.aaaa/index.php">
15</head>
16// or waits 15s before redirection
17<head>
18 <meta http-equiv="refresh" content="15;URL=http://www.aaaa/index.php">
19</head>
20
21// or via javascript
22<script>
23 window.location.replace('http://www.aaaa/index.php');
24</script>
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
1<?php
2// Redirect to mywebsite.com
3header("location:https://mywebsite.com");
4?>