How to set up {siteUrl} to work with both http and https I'm looking for a way to set up the general.php file's siteUrl to be able to use both http and https. Only the front-end login would be using the https. This is how I currently have it set up:

'mysite.com' =&gt; array(
    'cooldownDuration' =&gt; 0,
    'environmentVariables' =&gt; array(
        'siteUrl' =&gt; '//mysite.com/',
    )
)


The problem with this is when the front-end form is submitted and the user is redirected, the url messes up (i.e.: mysite.com/mysite.com/page-name)

Any suggestions would be great!
One method is using something like the following in your general.php file.  Using this method the config settings will take on the scheme of the request being made.  I've set both the siteUrl and example environmentVariables below:

&lt;?php

// Ensure our urls have the right scheme
define('URI_SCHEME',  ( isset($_SERVER['HTTPS'] ) ) ? "https://" : "http://" );

// The site url
define('SITE_URL',    URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');

// The site basepath
define('BASEPATH',    realpath(CRAFT_BASE_PATH . '/../') . '/');

return array(
    '*' =&gt; array(

        'siteUrl' =&gt; SITE_URL,

        'environmentVariables' =&gt; array(
            'siteUrl'  =&gt; SITE_URL,
            'basePath' =&gt; BASEPATH
        ),
    ),
);