-2

i just deployed my symfony 4 app but the problem that i'm facing is the app do not loads images,routes, css files and js files. i did install assets. here's what i get

Failed to load resource: the server responded with a status of 404 (Not Found)

my css file

 <link rel="stylesheet" type="text/css" href="{{ asset('assets/main/styles/responsive.css') }}">
  <link rel="stylesheet" type="text/css" href="{{ asset('assets/css/main.css') }}">

and my js

<script src="{{ asset('assets/main/js/main.js') }}"></script>
 <script src="{{ asset('assets/main/js/elements.js') }}"></script>

am i messing something i've searched everywhere but no result.

ted
  • 7
  • 2
  • 1
    I guess there is something wrong with your resource path.could you open your chrome debug tool,and check those red errors where it says file not found.Then you can compare it with you local resources url. – Charlie Cai Jun 02 '20 at 11:45
  • i did check it says GET http://myweb.com/assets/css/main.css net::ERR_ABORTED 404 (Not Found) i compared but still nothing @CharlieCai – ted Jun 02 '20 at 11:51
  • so you already publish it to production? can you do myweb.com/assets/css/main.css in your browser and see if you can download it? – Charlie Cai Jun 02 '20 at 11:54
  • still not working @CharlieCai – ted Jun 02 '20 at 11:59
  • if you cannot download file by input myweb.com/assets/css/main.css in you browser,it means it is not there.can you check other css,js files by input them in browsers and see if you can download or not. – Charlie Cai Jun 02 '20 at 12:01
  • now i can load files but i get blank webpage and in my browser console i get this DevTools failed to load SourceMap: Could not load content for mysite.com/public/assets/main/styles/bootstrap4/popper.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE @CharlieCai – ted Jun 02 '20 at 12:35
  • Not an expert of symfony 4.Do you need to run local debug server for you to access local site.2.Or you have to package it and install it on a PHP server? – Charlie Cai Jun 02 '20 at 12:54
  • i deployed on apache server with php so i think its enough i haven't deployed any website this is my first one i think thats why i face soo many problemes @CharlieCai – ted Jun 02 '20 at 13:02

1 Answers1

0

when you use "asset" it is going to look in the public directory.

Robert Saylor
  • 1,279
  • 9
  • 11