cf5ba7655d81a1287c3147171e4dd2cd0e5defb9
[squirrelmail.git] / index.php
1 <?php
2 /** This redirects to the login script **/
3
4 // Get the path
5 $path = substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'));
6
7 // Check if this is a HTTPS or regular HTTP request
8 $proto = "http://";
9 if(isset($HTTPS) && $HTTPS == 'on' ) {
10 $proto = "https://";
11 }
12
13 // Get the hostname from the Host header or server config.
14 // Fallback is to omit the server name and use a relative URI,
15 // although this is not RFC 2616 compliant.
16 if(isset($HTTP_HOST) && !empty($HTTP_HOST)) {
17 $location = $proto . $HTTP_HOST . $path;
18 } else if(isset($SERVER_NAME) && !empty($SERVER_NAME)) {
19 $location = $proto . $SERVER_NAME . $path;
20 } else {
21 $location = $path;
22 }
23
24 // Redirect
25 header("Location: $location/src/login.php\n\n");
26 exit();
27 ?>