Laravel include css, js using ssl

2019-04-13 05:38发布

I just installed an SSL cert onto my web server and I'm having some issues with my laravel setup.

I'm using

{{ HTML::style('css/style.css') }}

to include css and for js

{{ HTML::script('js/jquery.js') }}

Though when I load the page with https it seems to include the 2 with http instead of https.

Any idea why?

标签: php ssl laravel
2条回答
相关推荐>>
2楼-- · 2019-04-13 06:17

This might help.

In short you need to add a App:before in the app/filters.php.

查看更多
三岁会撩人
3楼-- · 2019-04-13 06:20

I had an issue with this too. My SSL is redirecting fine, but the CSS and JS links generated by {{ HTML::style('css/style.css') }} and HTML::script('js/script.js') were linking to the http versions.

If you look at the Illuminate\Html\HtmlBuilder Documentation you'll see that you can specify the secure version as follows:

{{ HTML::style('css/style.css', array(), true) }}

{{ HTML::script('js/script.js', array(), true) }}

true means $secure flag is on.

查看更多
登录 后发表回答