CSS is not reflected under Laravel https environment
Sep 7, 2020
PHP
CSS
beginner
Laravel
Laravel7
Purpose
- -Summary of the story that solved the problem that even if you try to create an original css file with Laravel and reflect it in the view file, it is not done at all
#Cause
- -The web server on which the Laravel application is running was converted to HTTPS, so the css file was not read because it was read differently.
#Cause and solution
-
-If you write with
asset ()
as shown below, you cannot read the CSS file under the https environment.<link rel = "stylesheet" href = "{{asset ('path from app name directory / public directory to CSS file')}}">
-
-By using
secure_asset ()
as shown below, you can read CSS while maintaining security even under https environment.<link rel = "stylesheet" href = "{{secure_asset ('path from app name directory / public directory to CSS file')}}"> <!-Slightly specific-> <link rel = "stylesheet" href = "{{secure_asset ('/ css / CSS file name')}}">
#References