P
P
Pavel2021-03-26 17:37:27
Laravel
Pavel, 2021-03-26 17:37:27

Why does asset refer to the site root and not the assets folder?

I do the initial steps in Laravel for any lessons, I connect js for example

<script src="{{ asset('/assets/admin/js/admin.js') }}"></script>

but in this case, it does not connect to the site, it works only if so
<script src="{{ asset('/public/assets/admin/js/admin.js') }}"></script>

but why? htaccess has already redirected us to the site, the public should no longer appear, what am I doing wrong?
I took htaccess and the code from the author, the only differences are 7.xx, and I have 8.xx versions of Laravel, but I didn’t find any differences in the documentation for version 8

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kudrya, 2021-03-26
@Mugenzo

If the development is local and not through artisan serve, then on openserver (if it is used, I just don’t work with another one), in the settings in the Domains tab, you need to specify the domain name and the desired folder.
If all this is on hosting, then when creating a site, when it requests a directory, you need to specify not just the domain to which it refers, but also add public, because as far as I remember, Apache has a file request limit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question