Search code examples
phphtmlcsslaravellaravel-4

laravel 4 css files 404 not found


These are my folders:

app
--->views
------->css
----------->font-awesome.css
----------->index.css
------->layouts
----------->restaurants.blade.php
------->restaurants
----------->create.blade.php

in restaurants.blade.php I tried this:

<link rel="stylesheet" href="{{ URL::asset('views/css/index.css') }}" />
        {{ HTML::style('views/css/font-awesome.css') }}

in both way, I got this exception:

http://localhost:8082/ProjectName/public/views/css/index.css 404 (Not Found)

http://localhost:8082/ProjectName/public/views/css/font-awesome.css 404 file not found

Could you help please?


Solution

  • Your assets are stored under your views, but you are linking to public.

    Put the assets that you need to load (css, imgs, js) under public. Then you can simply

    {{asset('css/style.css')}}
    

    for example.

    Also make sure your config/app.php document root is setup right, and if using apache, make sure that your vhost is setup properly to where /public/ is your Document Root.