Re: redirect http to https
| From: | Richard Lynch | Date: | Tue, 10 Apr 2007 23:24:56 +0000 |
| Subject: | Re: redirect http to https | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252497@lists.php.net to get a copy of this message | ||
On Mon, April 9, 2007 8:38 am, Martin Marques wrote:
> Ben Liu escribió:
>> What's the prescribed method for redirecting a user forcibly to from
>> the
>> non-SSL secured version of a page to the SSL-secured version? Is
>> this
>> handled at the web server level or at the script level. I found this
>> by
>> googling:
>
> This should be done with the rewrite instruction of apache, or what
> ever
> instructionyour web server has.
Assume, for the sake of argument, that you have no access to
mod_rewrite, httpd.conf, nor even .htaccess
>> <?php
>> if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !==
>> "on")
>> {header("Location:
>>
>> https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);exit;}
>> ?>
>
> Very bad solution.
What specifically is so bad?
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?