Helper Helper - 1 year ago 108
PHP Question

404 error in loading image: Laravel 5.1

When I am doing ?

In my Laravel 5.1 code, I created the Project with the name of SampleApplication...with the below path


Then after successful registration following directories are being created.



So far everything is ok.

What's the problem ?

In the dashboard page, I am trying to show the image like below.

<img src="{{url('/Users/' . auth()->user()->UserName . '/Profile/' .
auth()->user()->UserImage)}}" alt="..." class="img-circle profile_img">

This produces the below path.


What's the error ?

This is giving 404 error for the above image.

Am I missing something ?

Answer Source

Yes Laravel url default to public/, so for Laravel 5 or 5.1 rename the server.php in the your Laravel root folder to index.php and copy the .htaccess file from /public directory to your Laravel root folder.

Give a try, It Should work!!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download