Home > OS >  Laravel App Not Loading CSS From Public Installation Not In public_html
Laravel App Not Loading CSS From Public Installation Not In public_html

Time:03-18

I've installed a pre-made Laravel app and followed the documentation to extract it to the public root except in the documentation they are installing it into public_html, but I have it in a subdomain in a folder named "test" which is on the same level as public_html.

All the CSS and JS should be loading from the public subdirectory, but they try to look for it in the main root folder.

For example, this file returns a 404 error: https://test.mydomain.com/css/style.css

The file is actually at this location: https://test.mydomain.com/public/css/style.css

The absolute path of the file is: /home/mydomain/test/public/css/style.css

Instead of: /home/mydomain/public_html/public/css/style.css

What environment or config file isn't set correctly and how do I set it to use the correct directory?

UPDATE

Changing the ASSET_URL to "public" fixed the first issue, but now the same thing is happening with the admin.

The app tries to load the dashboard with this URL: https://test.mydomain.com/admin/dashboard

The page loads all the assets normally when I remove the word "admin" from the URL: https://test.mydomain.com/dashboard

But this doesn't work for all the pages.

CodePudding user response:

You can try to put public directory path in below given conflagration file.

Config File Path : config/app.php (asset_url)

 'asset_url' => env('ASSET_URL', 'https://test.mydomain.com/public/')
  • Related