Answer the question
In order to leave comments, you need to log in
Laravel in subfolder. How to set up correctly?
Hello,
I am deploying laravel on hosting in a subdirectory.
In principle, everything is put without problems, but there are problems with the paths that I don’t understand how to solve correctly.
The final path to laravel is something like this
uXXXXXX.cp.regruhosting.ru/sites/project_name/public
In css I have background-image
If I make the absolute path background-image: url("/images/bg/main_banner_bg.svg");
then as a result the url is uXXXXXX.cp.regruhosting.ru/images/bg/main_banner_bg.svg
i.e. does not fit sites/project_name/public/
If relative then background-image: url("images/bg/main_banner_bg.svg");
I get uXXXXXX.cp.regruhosting.ru/sites/project_name/publ...
those. css is added and accordingly nothing works
Option with mix.setResourceRoot('/sites/project_name/public'); and relative paths works if processCssUrls: true works, but it's tedious to uncomment this line every time you expand the code.
The option with processCssUrls: false doesn't work either.
I would like to somehow solve this at the .env level, but I didn’t find anything.
Tell me how to solve the issue
Answer the question
In order to leave comments, you need to log in
./
../
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question