search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

Refused to apply style from 'style.css' because its MIME type ('text/html') is not a supported s

今天把 Laravel 專案放到新建的 server 跑,出現了這個錯誤:

Refused to apply style from 'http://localhost:8080/assets/styles/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

找了很久都沒有找到原因,同時伴隨著部分頁面會出現 404。

Stackoverflow 這篇講了很多,但實際上我遇到的倒沒有這麼複雜,而且也不是因為因為 lib 引起的問題,最後在這篇找到解答,原來我只是忘記設定 Apache 的 Allow Override

DocumentRoot /var/www/sitefolder/public
ServerName site.domain.com

    AllowOverride All # 加上這行就可以了
    Allow from all
    Options +Indexes

最後執行 sudo systemctl reload apache2 就正常了。

References



熱門推薦

本文由 caloskaoorg 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦