0

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.

5
  • 1
    Did you try assign path in config/app.php (asset_url) key ? Commented Mar 16, 2022 at 5:17
  • How are you compiling the css using asset or using absolute path? Commented Mar 16, 2022 at 5:20
  • You put your laravel public directory files on public_html and your laravel files located outside of public_html? Commented Mar 16, 2022 at 5:29
  • @RavikantPatel please send in an answer and I'll upvote. This worked by setting the ASSET_URL to public. Commented Mar 16, 2022 at 18:51
  • yes, answer is added. Thank you in advance :) Commented Mar 17, 2022 at 4:59

1 Answer 1

2

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/')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.