Search code examples
laravel-5fontawesome-4.4.0

fontawesome not displaying in local


I am using fontawesome in my laravel project, the problem is that it will not display if I use it in local without using CDN.

<link href="{{ URL::asset('css/font-awesome.min.css') }}" rel='stylesheet' type='text/css'>

NetworkError: 404 Not Found - http://localhost/mysite/fonts/fontawesome-webfont.woff2?v=4.6.3"

"NetworkError: 404 Not Found - http://localhost/mysite/fonts/fontawesome-webfont.woff?v=4.6.3"

NetworkError: 404 Not Found - http://localhost/mysite/fonts/fontawesome-webfont.ttf?v=4.6.3

here is my fullpath of font-awesome.min.css

C:\wamp\www\mysite\public\css\

Thank you in advance.


Solution

  • This is because you are using the URL helpers incorrectly.

    If font-awesome.min.css is inside public/css then you want to be referencing it just using the asset() helper - you do not need to add the URL facade too.

    So just tweak your <link> tag a little like so:

    <link href="{{ asset('css/font-awesome.min.css') }}" rel='stylesheet' type='text/css'>