Re: [PHP] force https
Ross wrote: Hi, I need to force the url from http://mydomain.com to https://mydomain.com, so my ssl is active. Anyway this can be done with php? R. i'm a newbie, you've been warned header('Location: https://mydomain.com'); ? /i'm a newbie, you've been warned I don't know if that would work for an HTTPS referral - however, I don't know why it wouldn't Give it a shot, and if nothing else, let *me* know, even if it's off-list. Thanks -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] force https
On Tue, 2005-06-28 at 23:26, Dan Trainor wrote: Ross wrote: Hi, I need to force the url from http://mydomain.com to https://mydomain.com, so my ssl is active. Anyway this can be done with php? i'm a newbie, you've been warned header('Location: https://mydomain.com'); ? /i'm a newbie, you've been warned I don't know if that would work for an HTTPS referral - however, I don't know why it wouldn't Give it a shot, and if nothing else, let *me* know, even if it's off-list. It'll work fine, but here's a something a little more generic :) header( 'Location: https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ); Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] force https
Robert Cummings wrote: On Tue, 2005-06-28 at 23:26, Dan Trainor wrote: Ross wrote: Hi, I need to force the url from http://mydomain.com to https://mydomain.com, so my ssl is active. Anyway this can be done with php? i'm a newbie, you've been warned header('Location: https://mydomain.com'); ? /i'm a newbie, you've been warned I don't know if that would work for an HTTPS referral - however, I don't know why it wouldn't Give it a shot, and if nothing else, let *me* know, even if it's off-list. It'll work fine, but here's a something a little more generic :) header( 'Location: https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ); Cheers, Rob. Hey, you learn something new every day, huh. Thanks for the tip -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] force https
Robert Cummings wrote: On Tue, 2005-06-28 at 23:26, Dan Trainor wrote: i'm a newbie, you've been warned header('Location: https://mydomain.com'); ? /i'm a newbie, you've been warned It'll work fine, but here's a something a little more generic :) header( 'Location: https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ); Cheers, Rob. That'll work, but if you have the same files serving both the HTTP and HTTPS sites you might want to enclose it in the following, unless you like infinite loops: if($_SERVER['HTTPS'] != 'on') { } Assuming that you're using Apache. I'm not sure if other servers set that variable. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] force https
On Wed, 2005-06-29 at 00:44, Jasper Bryant-Greene wrote: Robert Cummings wrote: On Tue, 2005-06-28 at 23:26, Dan Trainor wrote: i'm a newbie, you've been warned header('Location: https://mydomain.com'); ? /i'm a newbie, you've been warned It'll work fine, but here's a something a little more generic :) header( 'Location: https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ); Cheers, Rob. That'll work, but if you have the same files serving both the HTTP and HTTPS sites you might want to enclose it in the following, unless you like infinite loops: if($_SERVER['HTTPS'] != 'on') { } Assuming that you're using Apache. I'm not sure if other servers set that variable. Yep, good catch. Recently I've been working with some hosts that force you to put the files in separate directories even though it means duplication, so I completely forgot about that :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php