Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

viktort1t0's avatar

Laravel on Shared Hosting Image issue

I know that is not a good practice to use Laravel on a shared hosting server but for this time i have no other choice right now. So, i put all the files outside the plubic_html folder and move the files inside the project/public folder to the public_html folder and everything works correctly except the images that are on the public_html folder. i tried a several stuff but until now i couldn't manage to show the images. Just in case you need more info, in my public folder i have a image folder with subfolders inside. If you have any suggestion i would appretiate your help.

0 likes
13 replies
Snapey's avatar

how have you referred to the images in your blade view? You will probably need to use the url to theimage, not use a Laravel helper as Laravel knows nothing about public_html

viktort1t0's avatar

i use this way {{ asset('images/made-with-bulma.png') }}

Snapey's avatar

not sure if you can change the behaviour of the asset helper.

What URI does it create. (check your browser source) ?

Your code could be replaced with src="/images/made-with-bulma.png"

viktort1t0's avatar

the weird part is that using assets to load the css files and the javascript files works correctly but is not working with images.

Snapey's avatar

view the source in your browser

Snapey's avatar

looks ok, so could be that you have not been careful about the letter case of your files?

viktort1t0's avatar

If you try to access to the file URL you wile have a 404 | not found message. That is why i'm not sure if i have to do something on the router or the .htaccess but i try a lot of code and nothing works until now

viktort1t0's avatar

If it help, my project is the only thing that is install on this cpanel account so the files from public folder of the laravel project go directly to public_html folder

viktort1t0's avatar

the other thing is you can access the assets url for the css files or the javascript files but not for the images. i change the folder permission just in case it was that but nothing yet.

Snapey's avatar
Snapey
Best Answer
Level 122

ok, so if you have htaccess file, any file that does not exist will be directed to index.php

It will then be checked against your routes and a 404 thrown if there is no matching route.

So, why would your web server think the file does not exist?

If your code says

/images/T1T0_logo-tiny.jpg

but your file is actually

/images/t1t0_logo-tiny.jpg

or your folder is

/Images

and to close this down NO you dont need to do anything with the router

viktort1t0's avatar

OMG i am so embarassed about this. Thanks @snapey for insist on the file and folders name. BTW it was the folders name it has a capital I on it.

Thanks guys for all the help

Please or to participate in this conversation.