0

I Have an question:

How to fixed error Notice: Undefined index: HTTPS in.

This is line code:

public static function Redirect($path = FALSE) {
        $_BASE_URL = $_SERVER["HTTPS"].'/';
        if(isset($path)){
            header("location:" . $_BASE_URL . $path);
            //exit();
        }
        else {
            header("location:" . $_BASE_URL);
            //exit();
        }
    }

The line with error:

$_BASE_URL = $_SERVER["HTTPS"].'/';

If need, i post the code complete here.

Thank You.

  • 1
    `_SERVER['HTTPS']` is, apparently, not set. Use `isset()`. The value will, however, be `on` or something so I don't know what you're expecting this code would do. It would send a header along the lines of: `location: on/foobar`. Also: `isset($path)` will always return `true` since you gave it a default value of `False` – RobIII Oct 23 '17 at 13:33
  • `$_SERVER["HTTPS"]`, *when set*, is *typically* either `'on'` or `'off'`… `on/` is probably not a sensible URL… – deceze Oct 23 '17 at 13:34
  • 1
    `$_SERVER` is an array containing information such as headers, paths, and script locations. **The entries in this array are created by the web server**. **There is no guarantee that every web server will provide any of these**; servers may omit some, or provide others not listed here. -- from the PHP Manual. – teeyo Oct 23 '17 at 13:36

0 Answers0