[FX.php List] [OFF] Rewrite for forcing http to https possible?

Tim 'Webko' Booth tim at nicheit.com.au
Thu Sep 11 16:15:45 MDT 2008


>>
>> http://www.site.com/page.htm
>>
>> your page would contain this:
>>
>> <HTML>
>> <HEAD>
>> <META HTTP-EQUIV="Refresh" CONTENT="0;url=https://www.site.com/page.htm 
>> ">
>> </HEAD>
>> <BODY BGCOLOR="#FFFFFF">
>> </BODY>
>> </HTML>
>>
>> At least, that's how I would do it... :)

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