Search code examples
phplaravel

Laravel asset() method not working if I installed in sub-directory instead of absolute url


This is not finding the assets from the public directory.

I installed laravel in subdirectory like:

http://localhost/yourproject

how can I fix this?


Solution

  • The asset() helper uses the app url. This is defined in .env.

    APP_URL=http://localhost/yourproject