Re: turn off the www

From: Date: Wed, 29 Jun 2005 18:13:51 +0000
Subject: Re: turn off the www
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-217852@lists.php.net to get a copy of this message
On Wed, 2005-06-29 at 10:57 -0700, Philip Hallstrom wrote:
I am using the following code to turn http into https and get my ssl working. if($HTTP_SERVER_VARS["HTTPS"] != "on") { $newurl = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; header("location: $newurl"); }
$newurl = "https://" . ereg_replace("^www.", "", $_SERVER["SERVER_NAME"])......
Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) ........ be a _hell_ of a lot faster?
Only if he can gaurantee that $_SERVER['SERVER_NAME'] *ALWAYS* is prefixed with "www." Otherwise he might end up with chost.com instead of aztechost.com... -philip

« previous php.general (#217852) next »