Php – Laravel 5 not find http://localhost:8000/css/app.css

bladelaravellaravel-5PHP

I am using Laravel 5 and got "Failed to load resource, the server responded with a status of 404(Not Found) http://localhost:8000/css/app.css"

If my layout.blade.php were

   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

It works fine.

But If I changed it to

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

I got

http://localhost:8000/css/app.css Failed to load resource: the server responded with a status of 404 (Not Found)

I have public/css/app.css
which I got from gulp and it clearly exists these.

If I entered http://localhost:8000/css/app.css from browser URL, I got an error NotFoundHttpException in RouteCollection.php line 161:" because I do not write /css/app.css at routes.php.

But I do not think this is a routing issue.

I know very similiar issue in Stack Overflow but can not find specific solutions.

Best Answer

I found a solution. There was no problem from the beginning.

The initial setting was correct.

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

The problem seems to be caused by Netbeans 8.1 embedded web server.

I was trying to test Windows 7 + Netbeans 8.1 embedded web server and always testing my program with http://xxx:8000/.

The problem seems to be caused by Netbeans 8.1 embedded web server.

Now I am using Xampp embedded Apache and works perfect.

Related Topic