I'm trying to add a CSS Stylesheet in Symfony with a classic link but it doesnt work i have the error "GET http://127.0.0.1:8000/public/css/style.css net::ERR_ABORTED 404 (Not Found)" in my browser. The path in my code is correct (as you can see below) but it doesnt work when i load the page. I'm using the Symfony web server it might come from that .
<meta charset="UTF-8">
<title>{% block title %}Bienvenue !{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link href="/public/css/style.css" rel="stylesheet"/>
<link rel="stylesheet"href="https://bootswatch.com/4/cosmo/bootstrap.min.css">
My website skeleton is the default composer one.
If you can help me find the issue it would be great.
You should use the asset command in twig:
href="{{asset('css/style.css')}}"
https://symfony.com/doc/current/reference/twig_reference.html#asset