K
K
Konstantin2016-02-03 09:05:10
Digital certificates
Konstantin, 2016-02-03 09:05:10

How to correctly migrate a project to Laravel 5 to https?

Hello. Yesterday I installed an SSL certificate on my hosting. The project on Laravel 5. The main page opens normally with the link https ://my_site But the rest of the pages open without styles, because for some reason, the styles on those pages are spelled out

<link href="HTTP://my_site/css/bootstrap.min.css" rel="stylesheet">

at the same time, the main page and other pages inherit the app.blade template . Everywhere should be the same links to include styles. I thought it was the cache. Cleared the folders storage/framework/sessions and storage/framework/views But everything remained unchanged. Tell me what could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Tokarev, 2016-02-03
@kostik34

At the beginning of /app/Http/routes.php add:
or depending on the environment settings:

if (env('SECURE_CONNECTION', false)) URL::forceSchema('https');

K
Konstantin, 2016-02-03
@kostik34

Failed to insert code into comment. I'll show you a part, because he is big.

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>@yield('title')</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Компания UVENTA - лучший интернет эквайринг">
  <meta name="author" content="Компания UVENTA">

  <link href="{{ asset('/css/bootstrap.min.css') }}" rel="stylesheet">
  <link href="{{ asset('/css/bootstrap-responsive.min.css') }}" rel="stylesheet">

  <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
  <!--[if lt IE 9]>
  <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->

  <!-- Icons -->
  <link href="{{ asset('/css/general_foundicons.css') }}" media="screen" rel="stylesheet" type="text/css" />
  <link href="{{ asset('/css/social_foundicons.css') }}" media="screen" rel="stylesheet" type="text/css" />
  <!--[if lt IE 8]>
  <link href="{{ asset('/css/general_foundicons_ie7.css') }}" media="screen" rel="stylesheet" type="text/css" />
  <link href="{{ asset('/css/social_foundicons_ie7.css') }}" media="screen" rel="stylesheet" type="text/css" />
  <![endif]-->
  <link rel="stylesheet" href="{{ asset('/css/font-awesome.min.css') }}">
  <!--[if IE 7]>
  <link rel="stylesheet" href="{{ asset('/css/font-awesome-ie7.min.css') }}">
  <![endif]-->

Now I tried to add a self-signed certificate on a working computer. The main page is shown, but the rest are not found at all
also noticed that when return redirect() is called, the redirect goes to http instead of https

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question