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

alanaasmaa's avatar

Laravel can't find my css and js.

Hello, i tryed to push my site online for testing purpouses.

I'm using some random free hosting site for my portfolio and it was confusing but i got it online. Everything seems to work except laravel can't find my css.

It tryes to find them @ domain.com/css/app.css but the right url is domain.com/public/css/app.css

Im using this type of url

I have pushed all my files public_html witch is default apache directory for my host.

I know i can set it like asset('public/css/app.css') but i think it should work like that too with some cfg.

0 likes
3 replies
ftiersch's avatar
ftiersch
Best Answer
Level 28

Do you have access to change the apache root directory with your host? Then you should point that to the public folder which is the recommended way for security reasons.

1 like
Hamelraj's avatar

If you want use same directory which already your css path just press CLT+shift+i check is your path is correct then asign your path like this

  <link href="{{ asset("/path/file.css")}}" rel="stylesheet" type="text/css" />
1 like
seanwu's avatar

or you could create a symbolic link so that public_html directory points to the Laravel public directory. You'd need to rename the current public_html to something else first.

Although I'm not sure if this raises up any security concerns? would love to know if it does :)

Please or to participate in this conversation.