The path alias works in two ways - Yii2

Hi, i have a such problem:

In Yii2 advanced, in common/config/bootsrap.php has created @alias in which it is necessary to store photos, but there is a problem:

  • if the script runs on the frontend - then the @folder is created in

    one place

  • and if the script runs on the backend - then the @folder is created

    elsewhere.

How to make so that the folder was created only in frontend?

More information:

Image with directory structure:

7610

stack.png

.htaccess file code for both files

7611

htt.png

Code for: backend/controllers/ActionThatCreateTheDirecotry:

$dir = Yii::getAlias(’@images’) . ‘/blog/’;

FileHelper::createDirectory($dir);

I maked the next modifications and it’s working:

Yii::setAlias(’@images’, dirname(dirname(dirname(DIR))) . ‘/../uploads/images’);