ExpressionEngine access via both http and https

∥☆過路亽.° 提交于 2019-12-06 08:20:27

It's because EE variables don't detect or utilise https by default, so you have to set them in code. The easiest way is to use an add-on:

http://devot-ee.com/add-ons/https-support

http://devot-ee.com/add-ons/dm-force-ssl

http://devot-ee.com/add-ons/force-ssl (commercial)

(In no particular order) I've not used any of these so can't recommend a specific one as I use my own plugin.

Do you need to include the root URL? Often times I'll set the root URL of a site to just '/'.

Another option would be to manually include those assets (not using path or style helpers).

If a URL is realtive it will automatically inherit the current protocol.

You can detect the protocol with PHP and set it dynamically in your system/expressionengine/config/config.php file. I use something like this:

$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];

$config['base_url'] = $base_url . "/";

You can build your theme paths, various image paths, upload paths, etc all from that basis in config.php. But $config['site_url'] is what affects the output of {path=""} and {stylesheet} tags.

For more information, see NSM's Config Bootstrap file or the article Configuring ExpressionEngine for multiple servers. For all the paths you can set in config.php, see EE2 Config Overrides

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!