In Contao 3.5.9
I have uploaded to new server and am using a different domain from the original installation. I am also using https://
Many of the resources needed are not being loaded because the system has the base url set to http:// It is using the correct domain name in the base url, but the wrong protocol.
I cannot login to the admin.
I searched Google (not much there about Contao) and found this: http://blog.qzminski.com/article/move-the-contao-to-another-server.html
reading it, it seems that the base url is set in the admin, which means it can be found somewhere in the db.
I have search the DB dump but cannot find it.
How can I change the protocol of the base url?
Contao uses the following to determine whether the current request is done via SSL or not » \Environment::get('ssl')
:
/**
* Return true if the current page was requested via an SSL connection
*
* @return boolean True if SSL is enabled
*/
protected static function ssl()
{
return ($_SERVER['SSL_SESSION_ID'] || $_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1);
}
It is possible that your server environment does not set either of these $_SERVER
globals. This can be the case if you are using an SSL proxy for example.
If that is the case for you, then you can extend the SSL detection by inserting
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'])
{
$_SERVER['HTTPS'] = 1;
}
into your /system/config/initconfig.php
. See https://github.com/contao/core/issues/7542 for example (only German though).
来源:https://stackoverflow.com/questions/36773112/contao-how-can-i-change-the-protocol-of-the-base-url