Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

octobercms - how to make it so that $this->addCss adds https links instead of http

In my myproject/themes/mytheme/layouts folder I have a file - default.htm - that reads like this:

description = "Default"
==
<?php
function onStart()
{
$this->addCss('/themes/mytheme/assets/css/bootstrap.min.css');
$this->addCss('/themes/mytheme/assets/css/custom.css');
$this->addCss('/themes/mytheme/assets/css/bootstrap-select.min.css');
}
?>
==
blah blah blah

The problem is that my website is being served up via https while the CSS links generated by $this->addCss() are being added with http (vs https).

How can I make it so that the generated links are https instead of http?

question from:https://stackoverflow.com/questions/65853583/how-to-make-it-so-that-this-addcss-adds-https-links-instead-of-http

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

$this->addCss() will detect automatically what to use http or https from current scheme.

Still, if you face an issue you can tell OctoberCMS to use https using config.

config/cms.php

enter image description here

if any doubts please comment.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...