Laravel Bootstrap Styling is not working when i remove public from the URL and when i add Public on url the styling works

Viewed 323

Master View file

It is when the public is in the URL

After removing public from URL

the Bootstrap file is in public in Bootstrap/css/bootstrap.css

2 Answers

open vendor\laravel\framework\src\Illuminate\Foundation\helpers.php

write "public/".$path instead of $path,

function asset($path, $secure = null){
   return app('url')->asset("public/".$path, $secure);
}

its work in your all css and js without write public in assets

It because of your all CSS and js is inside the public folder. add asset as below to js and css.

{{ asset('public/bootstrap/css/bootstrap.css') }}

Or you can set asset url in .env file as well.

ASSET_URL=public in your .env file and run php artisan config:cache

Related