[PHP] turn off the www

2005-06-29 Thread Ross
now. 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); } However I set the ssl up on http://mydomain.com not

Re: [PHP] turn off the www

2005-06-29 Thread Philip Hallstrom
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])..

Re: [PHP] turn off the www

2005-06-29 Thread John Nichel
Ross wrote: now. 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); } However I set the ssl up on http://mydomain.com not

Re: [PHP] turn off the www

2005-06-29 Thread André Medeiros
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); }

Re: [PHP] turn off the www

2005-06-29 Thread John Nichel
André Medeiros wrote: snip $newurl = https://; . ereg_replace(^www., , $_SERVER[SERVER_NAME]).. Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? /snip If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ --

Re: [PHP] turn off the www

2005-06-29 Thread Philip Hallstrom
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://;

Re[2]: [PHP] turn off the www

2005-06-29 Thread Richard Davey
Hello André, Wednesday, June 29, 2005, 8:03:00 PM, you wrote: AM Wouldn't AM $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) AM be a _hell_ of a lot faster? Sure.. providing they always link to the page using www.domain.com (and the same goes for anyone else who links to

Re: [PHP] turn off the www

2005-06-29 Thread Kevin L'Huillier
Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) be a _hell_ of a lot faster? If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_ And it could be slower if you avoid sending someone from http://example.com/ to https://ple.com/ by

Re: [PHP] turn off the www

2005-06-29 Thread André Medeiros
OK OK I got it ;) I just suggested it because I thought he could assume that www. would always be on the string. Either way, I guess _one_ preg_replace is alright. On 6/29/05, Kevin L'Huillier [EMAIL PROTECTED] wrote: Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 )

Re: [PHP] turn off the www

2005-06-29 Thread Philip Hallstrom
OK OK I got it ;) I just suggested it because I thought he could assume that www. would always be on the string. Either way, I guess _one_ preg_replace is alright. Heh :-) Just for kicks... - randomly prefix www. onto 1324 proper names (dictionary file). 659 end up with www. prefixed. -

Re: [PHP] turn off the www

2005-06-29 Thread André Medeiros
People have fun with the oddest things ;) Anyway, it's a nice reference to have around :) On 6/29/05, Philip Hallstrom [EMAIL PROTECTED] wrote: OK OK I got it ;) I just suggested it because I thought he could assume that www. would always be on the string. Either way, I guess _one_

Re: [PHP] turn off the www

2005-06-29 Thread Jochem Maas
[top posting out of spite] ;-) I'm guessing that the OP is only dealing with 1 domain? why not... ? // define in a handy config file? define('BASE_DOMAIN', 'yourdomain.com'); if($HTTP_SERVER_VARS['HTTPS'] != 'on') { header('location: https://'.BASE_DOMAIN.$_SERVER[REQUEST_URI]); } ?