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

DavP2021's avatar

Laravel 6 CSS and JS 404 error after deployment to shared hosting

I have deployed to cpanel shared hosting, all the laravel folders and files are located in the public_html folder which is the root directory. Here is my question how do I fix the 404 error for CSS, JS and images? Here is my folder structure from cpanel file manager

  • public_html
    • app
    • bootstrap
    • config
    • public (all css, js here) ........ .......
    • index.php
    • server.php ........ -webpack.mix.js. I get the 404 error for CSS,JS and some images. if enter www.mysite.com/public/style.css in browser I can see the style.css file open, whereas www.mysite.com/style.css doesn't show the style.css file.

I used <link rel="stylesheet" type="text/css" href="{{ URL::to('style.css') }}"> got 404 error. I need to update the public path but not sure where, please help, thanks

0 likes
4 replies
Sinnbeck's avatar

Is the .env file in that folder as well? If so, remove it at once (as anyone can get access to it).

DavP2021's avatar

Okay, just did, thanks. please how do I fix the 404 error.

Please or to participate in this conversation.