Home > Software design >  Laravel images, js and files are returning a 404 (deprecated)
Laravel images, js and files are returning a 404 (deprecated)

Time:05-13

NOT NEEDED ANYMORE

old question: This is how the images are called:

<img src="/images/layout/incassomachtigen.png" />

The public folder is in the root so maybe that has to do with it?

My .htaccess file:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (. )/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>

Also, some of the images have 2 slashes in the network tab:

http://localhost:8000/images//layout/intentie.jpg

CodePudding user response:

Your internal links to images, css and js should be like this pattern. Change it related to your Laravel path.

<img src="{{ asset('images/layout/incassomachtigen.png') }}"  alt="">

CodePudding user response:

use the following way. Hope this solves your problem

<img src="{{asset('/images/layout/incassomachtigen.png')}}" />
  • Related