How can I solve net::ERR_ABORTED 404 (Not Found) in a view, error dont let display the css Laravel 6.0?

How can I solve net::ERR_ABORTED 404 (Not Found) in a view, error dont let display the css Laravel 6.0?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Diagnosing Mixed Content and Missing Assets in Laravel Views

When you encounter net::ERR_ABORTED 404 (Not Found) errors for specific assets like css/bootstrap.min.css or js/jquery.stellar.min.js, the browser is explicitly telling you that it cannot locate those files at the requested URL. In your case, the error logs show requests failing against paths like /entradas/1/comprar/1/detalle_ventaEntrada/200000/css/bootstrap.min.css. This pattern indicates a fundamental mismatch between how your application generates URLs for resources and where those resources actually reside in your file system.

The root cause here is the absence of Laravel's asset helper functions on external libraries while using them on local files, combined with a routing context that suggests you are embedding static assets directly into a dynamic URL path.

The Path Mismatch Problem

Looking closely at your <head> and <body> tags, there is an inconsistency in how you are linking to resources. You correctly use the {{ asset('...') }} Blade directive for files located within your public directory:

<script src="{{ asset('js/app.js') }}" defer></script>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">

However, for external libraries like Bootstrap or jQuery, you are using relative paths without the asset() helper:

<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.min.js"></script>

When this view is rendered inside a route such as detalle_ventaEntrada/200000, the browser concatenates the current page URL with these relative paths. Instead of resolving to /public/css/bootstrap.min.css, the browser attempts to fetch /entradas/1/comprar/1/detalle_ventaEntrada/200000/css/bootstrap.min.css. Since your public/css folder does not exist at that deep directory level, the server returns a 404.

Why This Happens Only with Data

You noted that the error disappears when no information is sent to the view. This behavior often stems from conditional logic in your layout or the specific route being used. If your master layout file includes these assets only when certain data exists, or if you are manually appending query parameters or segments to the asset paths based on user input, the URL construction becomes fragile.

For example, if a previous version of your code dynamically built the path using public_path('css/' . $someVariable), and that variable was empty or null during the "no data" state, the browser might have defaulted to a root-relative path that happened to work. However, once you inject data into the view, any dynamic URL construction based on that data will likely break if it assumes a nested directory structure that doesn't exist.

The Solution: Using asset() Consistently

To resolve this, you must ensure every single resource link points back to the Laravel public root, regardless of whether the file is local or external (if hosted there). Update your HTML tags to use the {{ asset() }} directive for all CSS and JS files.

Here is how the corrected <head> section should look:

<head>
    <title>ACAVUCAB</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <!-- Use asset() for all local and external assets to ensure correct path resolution -->
    <script src="{{ asset('js/app.js') }}" defer></script>
    <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/open-iconic-bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/animate.css') }}">
    <!-- ... other local stylesheets ... -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">

    <!-- Scripts should ideally be at the end of <body>, but if in <head>: -->
</head>

For the scripts, apply the same logic:

<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/jquery-migrate-3.0.1.min.js') }}"></script>
<!-- ... other scripts ... -->

By wrapping every path in {{ asset() }}, Laravel will prepend the correct base URL (e.g., http://127.0.0.1:8000) to the relative path, ensuring the browser requests /public/css/bootstrap.min.css instead of nesting it inside your route parameters.

Handling External CDNs

If these libraries are not in your resources/public folder but are hosted on a CDN (like jsDelivr or cdnjs), you should use absolute URLs directly without the asset() helper, as they point to a completely different domain:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

Ensure that you do not mix relative paths and absolute URLs in the same document, as this can lead to further confusion regarding asset loading contexts. If you are mixing local files with CDN links, verify that your asset() calls only target files inside your project's public directory.

Deployment Considerations

Once you have corrected the code locally, remember that Laravel's development server (php artisan serve) serves static files directly from the file system. In a production environment running on Nginx or Apache with PHP-FPM, the web root is typically configured to point directly to public/. If your asset paths were previously working in dev but broke in production, it might be due to how the server resolves relative paths versus absolute paths. Using {{ asset() }} eliminates this ambiguity entirely, ensuring consistent behavior across both development and production environments.

If you need further assistance with Laravel asset management or deployment configurations, you can explore best practices and community discussions at https://laravelcompany.com.

Our network