forked from drunken-monkey/porter2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
23 lines (21 loc) · 649 Bytes
/
index.php
File metadata and controls
23 lines (21 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/**
* @file
* This file simply redirects to /demo. For demonstration purposes only.
*/
if (php_sapi_name() != "cli") {
$url = $_SERVER['HTTP_HOST'];
$www = strpos($url, 'www.');
if ($www === 0) {
// The request begins with "www." . Rewrite the URL only to include
// everything after "www." and trigger the redirect.
$url = substr($url, 4);
}
if (strpos($url, 'localhost') === FALSE) {
// Send all traffic to HTTPS.
header('HTTP/1.0 301 Moved Permanently');
header('Location: ' . 'https://' . $url . $_SERVER['REQUEST_URI'] . 'demo');
header('Cache-Control: public, max-age=3600');
exit();
}
}