Cobolt
Cobolt

Reputation: 953

CSS files in Laravel 5.1 not accessible, not found

I am trying to include a css file to my page. I have done this in my blade template:

<link rel="stylesheet" href="{{ asset('css/frontend.css')}}">

I then my css file in {laravel_root}/public/css/frontend.css

The resulting page outputs

<link rel="stylesheet" href="http://hbnw.app/css/frontend.css">

But using chrome's development tools I see that upon request the server returns a 200 OK response but the file is empty.

I am running in a homestead environment. Do I need to do something with Laravel 5's routes or is there a completely different workflow for css? Could I just change the htaccess to return the files for all requests starting with /css and /js?

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Thanks in advance.

Upvotes: 1

Views: 751

Answers (2)

Cobolt
Cobolt

Reputation: 953

I'm not sure what was wrong but it's working now. My apologies.

Upvotes: 0

bernie
bernie

Reputation: 10400

Laravel doesn't process files in the public folder. The .htaccess that comes with Laravel only sends requests through the Laravel routes (index.php) when they don't match an existing file or folder in the public directory.

Upvotes: 2

Related Questions