Author Topic: http and https support in the config.php  (Read 5354 times)

Claudio69

  • Newbie
  • *
  • Posts: 24
    • View Profile
http and https support in the config.php
« on: January 07, 2010, 08:04:47 pm »
i just changed the code for define the root_url as follow:

if ($_SERVER['HTTPS']=='on')
{
  define('ROOT_URL', 'https://mydomain.com:8081/opengoo');
}
else
{
  define('ROOT_URL', 'http://mydomain.com/opengoo');
}

with this very easy code change i can use opengoo with https and with normal http!

Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: http and https support in the config.php
« Reply #1 on: January 08, 2010, 04:44:21 am »
Nice tip claudio
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?

interjinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: http and https support in the config.php
« Reply #2 on: February 13, 2010, 07:33:00 pm »
I prefer to force access to HTTPS so that it's guaranteed to be over a secure connection:

Code: [Select]
    if( !isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] !== 'on' )
    {
        $url = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
        header( 'Location: '.$url );
        exit();
    }

interjinn

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: http and https support in the config.php
« Reply #3 on: February 13, 2010, 07:34:28 pm »
Actually, now that I think of it, I can't remember if Feng does the redirect for me or not if I set the URL to have https... I did this when I first started using it... so maybe it's unnecessary :)