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

laraDev98's avatar

Add Public to asset path in Laravel

I want to install laravel in shared hosting and I followed the steps here http://stackoverflow.com/a/28449523 but my asset path doesn't include the public directory

Instead of this <linkhref='http://example.com/public/assets/css/style.css' type='text/css' media='all' />

I'm getting this ```<linkhref='http://example.com/assets/css/style.css' type='text/css' media='all' />``

How do I change the asset folder without changing any core classes?

0 likes
4 replies
bugsysha's avatar

Use base_path() or public_path() or type it manually. Not sure which will work but manual approach should.

laraDev98's avatar

Is there no other way?! I don't want to hard code asset path.

bugsysha's avatar

Ofc there is. You can create your own helper. You can change existing helper.

Tell us what do functions I mentioned return on that hosting and then maybe we will come up with something smarter. Most of the people here do not bother with shared hosting.

Please or to participate in this conversation.