why isnt this redirecting my page to https://www.mydomain.com instead the page stays at my domain.com
<?php

class URL {

        // Public Variables
        public $HTTPS;
        public $ServerName;
        public $WWW;
        
        // Public Functions
        
        public function __construct() {
                $this->checkHTTPS();
                $this->checkWWW();
                $this->ServerName = $_SERVER['SERVER_NAME'];
        }
        
        // Check if HTTPS
        public function checkHTTPS() {
                if ($_SERVER['HTTPS'] != "on") {
                        $this->HTTPS = false;
                } else {
                        $this->HTTPS = true;
                }
        }
        
        // Redirect to HTTPS Site
        public function HTTPSRedirect() {
                if($this->HTTPS = false) {
                        $redir = "Location: https://"; . $_SERVER['SERVER_NAME'];
                        echo $redir;
                        header($redir);
                }
        }
        
        // Check if site is preceeded by 'WWW'
        public function checkWWW() {
                 return true;
        }
        
        // Redirect to WWW
        public function WWWRedirect() {
                if ($this->WWW = false) {
                        $redir = "Location: http://www."; . 
$_SERVER['SERVER_NAME'];
                        header($redir);
                }
        }

}

$myURL = new URL();
$myURL->HTTPSRedirect();

?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to