Support the ongoing development of Laravel.io →
Configuration

Hi everyone. after install Laravel 5.2 , And I was copy download img (name:t.jpg) to public folder(img/t.jpg), but I got a problem.

If I use asset() function like this first sample: <div><img src="{{ asset('public/img/t.jpg') }}" /></div> And It's Working ,Will show images in website,

When the first sample is working , I get http://localhost/laravel/public/img/t.jpg . But I want to like this second sample: <div><img src="{{ asset('img/t.jpg') }}" /></div> Can be Working.

Then when the second sample is working , I will just get the same http://localhost/laravel/public/img/t.jpg

So , How do I set something config or will just asset() point to public folder

Please help me to resolve this problem. I'm using Laravel 5.2

Last updated 3 years ago.
0

Your webserver should have the document root/web root pointing to laravel's public folder. There should not be public in the url at all.

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

sktdeity sktdeity Joined 2 Jun 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.