Redirect to https

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
t3knoid
Posts: 4
Joined: 30 Apr 2009, 21:44

Redirect to https

Post by t3knoid »

Here's a snippet of code that I am using to redirect http request to the https version of the site. I had to use this to avoid using .htaccess method of redirection. Add this code to core.php right after the ob_start ('compress_handler' ) call:

Code: Select all

        
if ( isset ( $_SERVER['HTTPS'] ) != 'on' ) {
   $g_header="https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URL'];
   header( "Location: " . $g_header );
}
Kirill
Posts: 640
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Redirect to https

Post by Kirill »

What problem did this in config_inc.php?

Code: Select all

	$t_protocol = 'https';
	$t_port = ':443';
	$t_path = '/bug';
	$g_path = $t_protocol . '://' . $t_host . $t_path.'/';
	$g_short_path = '/bug/';
fonnnnnn
Posts: 13
Joined: 11 Mar 2011, 10:27

Re: Redirect to https

Post by fonnnnnn »

i just change config in


config_inc.php and insert

$g_path = isset( $t_url ) ? $t_url : 'https://localhost/mantisbt/';

and it works ^^
Post Reply