Answer the question
In order to leave comments, you need to log in
How adequately did I do the trick with removing the web folder?
In general, I decided to remove the web folder not through a redirect in two htacess files. Although a friend claims that there is another, simpler way without a crutch with htaaccess. But I did it differently.
Moved index.php to the root slightly rewrote the paths
<?php
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';
$config = require __DIR__ . '/config/web.php';
(new yii\web\Application($config))->run();
Answer the question
In order to leave comments, you need to log in
Terrible trick
The server should look in the public folder, where there is ONLY an entry point and static files The
htaccess crutch is already garbage
Your "trick" is completely garbage
And now you have a view link http://site.com/composer.json
that returns what you need?
The index.php handler is hidden in order to close the possibility of the user wandering through the child directories, and not for fun. Undoubtedly, everything will work (if configured correctly), but now you need to add an htaccess file to all subdirectories of the root folder to deny access there. Where is the profit?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question