Apparently the problem was in those files permission , i set it to 755 for folders and 644 for files and everything worked like charm
laravel public_html files fail to load in shared hosting
My laravel (v5.8) project works fine in localhost , but after i uploaded it to cpanel all images and css and JS files in public html failed to load in the browser and show errors in browser console like :
"Failed to load our-approach.png:1 resource: the server responded with a status of 404 ()" "Failed to load resource: the main.css:1 server responded with a status of 500 ()"
While the framework itself loaded fine and show no errors. I updated php to 7.4 and followed almost every youtube and articles and nothing worked.
index.php modified :
require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
AppServiceProvider.php modified :
public function register()
{
$this -> app -> bind('path.public', function()
{
return base_path('public_html');
});
}
My project structure in cpanel :
|-- bin
|-- cache
|-- laravel (project files without the public folder)
|-- app
|-- bootstrap
|-- config
.env
server.php
... and the rest of the files
|-- etc
|-- logs
|-- mail
|-- public_html
|-- css
|-- js
|-- img
.htaccess
index.php
...rest of files
Please or to participate in this conversation.