E
E
Eugene2018-06-14 11:08:31
Yii
Eugene, 2018-06-14 11:08:31

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();

And I added /web/ to the images to the links
+ in connecting scripts from @web changed to web/
Scripts are connected, ajaxes work, although Yii2 scripts js-snye cause one glitch, but in fact everything works.
How bad is this option and will there be a problem with setting the CNC?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2018-06-14
@Maksclub

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

D
Dmitry Kim, 2018-06-14
@kimono

And now you have a view link http://site.com/composer.jsonthat 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 question

Ask a Question

731 491 924 answers to any question