Tapas
Tapas

Reputation: 123

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?

Upvotes: 0

Views: 2894

Answers (4)

Simon
Simon

Reputation: 233

I had to change ASSET_URL=public to ASSET_URL=/public in my .env file as I had my site in a subfolder

Upvotes: 0

juan villalta
juan villalta

Reputation: 21

This work for me: .env

ASSET_URL=http://localhost/yourproject

Upvotes: 2

Michał B
Michał B

Reputation: 96

Adding ASSET_URL=public to .env file helped me.

Upvotes: 2

Devon Bessemer
Devon Bessemer

Reputation: 35337

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

APP_URL=http://localhost/yourproject

Upvotes: 0

Related Questions