I have just installed the Yii2 Basic Application Template using Composer.
This is now accessible on my localhost machine at the following URL:
http://localhost/basic/web
In Yii 1.1, it was possible to access a web application by simply going to :
http://localhost/basic
Having done some reading, it appears the only way to achieve the above is to create a new Apache vhosts entry. Whilst this is fine for one or two sites, if like myself you are working on new sites all the time, it is a bid tedious to have to set up vhosts for each and every site.
I have tried creating a .htaccess
file to redirect all requests to web/index.php
but this does not work. Is this at all possible to do in Yii2?
Move all the content in the /basic
folder to eg. /basic-yii
instead. Then take the /basic/web
folder (now /basic-yii/web
) and put all it's content into the /basic
folder. Then adjust the paths for the require()
calls in /basic/index.php
to correctly point to autoload.php
, Yii.php
and web.php
.