Laravel 5.1中的CSS文件无法访问,找不到

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.

douqiao7188
douqiao7188 文件是空的还是找不到?
大约 5 年之前 回复

2个回答



Laravel不处理公用文件夹中的文件。 Laravel附带的 .htaccess </ code>仅在与公共目录中的现有文件或文件夹不匹配时才通过Laravel路由(index.php)发送请求。</ p>
</ DIV>

展开原文

原文

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.



我不确定出了什么问题,但它现在正在运作。 我道歉。</ p>
</ div>

展开原文

原文

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐