src/Control/Middleware/CanonicalURLMiddleware.php
protected function isEnabled()
    {
        // At least one redirect must be enabled
        if (!$this->getForceWWW() && !$this->getForceSSL()) {
            return false;
        }

        // Filter by env vars
        $enabledEnvs = $this->getEnabledEnvs();
        if (is_bool($enabledEnvs)) {
            return $enabledEnvs;
        }

        // If CLI, EnabledEnvs must contain CLI
        if (Director::is_cli() && !in_array('cli', $enabledEnvs)) {
            return false;
        }

        // Check other envs
        return empty($enabledEnvs) || in_array(Director::get_environment_type(), $enabledEnvs);
    }
protected function isEnabled()
    {
        // At least one redirect must be enabled
        if (!$this->getForceWWW() && !$this->getForceSSL()) {
            return false;
        }

        // Filter by env vars
        $enabledEnvs = $this->getEnabledEnvs();
        if (is_bool($enabledEnvs)) {
            return $enabledEnvs;
        }

        // If CLI, EnabledEnvs must contain CLI
        if (Director::is_cli() && !in_array('cli', $enabledEnvs)) {
            return false;
        }

        // Check other envs
        return empty($enabledEnvs) || in_array(Director::get_environment_type(), $enabledEnvs);
    }
protected function isEnabled ( ) { // At least one redirect must be enabled if ( ! $ this -> getForceWWW ( ) && ! $ this -> getForceSSL ( ) ) { return false ; } // Filter by env vars $ enabledEnvs = $ this -> getEnabledEnvs ( ) ; if ( is_bool ( $ enabledEnvs ) ) { return $ enabledEnvs ; } // If CLI, EnabledEnvs must contain CLI if ( Director :: is_cli ( ) && ! in_array ( 'cli' , $ enabledEnvs ) ) { return false ; } // Check other envs return empty ( $ enabledEnvs ) || in_array ( Director :: get_environment_type ( ) , $ enabledEnvs ) ; }
Ensure this middleware is enabled
Ensure this middleware is enabled