T
T
tincap2015-08-31 13:17:01
Yii
tincap, 2015-08-31 13:17:01

How and where is @web alias defined in Yii2?

There is an old project on Yii2. In it, Yii::getAlias('@web') returns /project/web
Now I can't throw my new project on the server, since its Yii::getAlias('@web') is empty, and therefore the site cannot find css and js files. Where is the web root defined in the configuration?
The thing is that the project is located in the main domain folder domen/project/web
All links lead to domen , although they should lead to domen/project/web
B all js try to connect from js/main.js , although they should connect from project/ web/js/main.js

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
tincap, 2015-08-31
@tincap

I set baseUrl = '' in the configuration.
It needs to be removed

V
Vlad Pasechnik, 2015-08-31
@jumper423

$config = [
'aliases' => [
        '@foo' => '/path/to/foo',
        '@bar' => 'http://www.example.com',
    ],
];

S
Sergey Sviridonov, 2017-12-29
@HTMLord

I have with given baseUrl:
Yii::getAlias("@webroot");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question