[FX.php List] [OFF] Rewrite for forcing http to https possible?
Troy Meyers
tcmeyers at troymeyers.com
Thu Sep 11 16:39:45 MDT 2008
Tim,
I guess I should have read all the messages before I did my last reply.
Yes, that's something I considered, and will probably do it that way if the RewriteRule won't work. It does have the trouble of patching it into the CDML section, but that's not insurmountable.
I have used RewriteRule successfully for a number of things, such as this:
http://troymeyers.com/flasking/item.php?id=TN1525&kind=plant
getting turned into:
http:/lab.troymeyers.com/flasking/item.php?id=TN1525&kind=plant
..or RewriteRule in combination with header() to get:
http://troymeyers.com/direct/?121525
to turn into:
http://lab.troymeyers.com/flasking/item.php?id=TN1525&kind=plant
...right in the user's browser.
Try both of those and see what I mean:
http://troymeyers.com/flasking/item.php?id=TN1525&kind=plant
http://troymeyers.com/direct/?121525
I guess I just like it because I set it up in one place and forget it.
Has anyone said that it just won't work?
-Troy
> Well, if they're actually the same page but on different ports (80 for
> http, ?? for https) I'd use a server side redirect rather than a
> client-side.
>
> I'd think that with some of the SERVER variables you could do
> something like
>
> <?php if ($_SERVER['SERVER_PORT'] == 80) {
>
> //Construct a variable pointing back to the same name under https
>
> $server = $_SERVER['SERVER_NAME'];
>
> $page = $_SERVER['PHP_SELF'];
>
> header['location: https://$server/$page/'];
>
> } ?>
>
> (And I'm certain that is not correct code, but it's where I'd start
> and fiddle with it from there...)
>
> Cheers
>
> Webko
More information about the FX.php_List
mailing list