简体   繁体   English

公用文件夹中的Laravel CSS和JS显示404错误

[英]Laravel CSS and JS in public folder showing 404 error

I have my CSS and JS in the public folder and when I load my site it is showing the files as 404 error resource not found. 我在公用文件夹中有CSS和JS,当我加载网站时,它显示的文件为404错误资源未找到。 How can I resolve? 我该如何解决? I have the below index file in my root folder 我的根文件夹中有以下索引文件

require __DIR__.'/bootstrap/autoload.php';

$app = require_once __DIR__.'/bootstrap/app.php';

I then have my layouts file calling the css/js files like for example... 然后,我将布局文件调用css / js文件,例如...

href="{{ asset('plugins/bootstrap/css/bootstrap.min.css') }}"
src="{{ asset('plugins/bootstrap-modal/js/bootstrap-modal.js') }}"

What else do I need to change? 我还需要更改什么? i dont wish to add public in the path for the resources. 我不想在资源的路径上增加公众。 How else can I do this? 我还能怎么做?

Server config file is as below 服务器配置文件如下

if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';

您可以从以下网站包括引导程序: https : //cdnjs.com/libraries/twitter-bootstrap/使用此方法也可以提高性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM