you have to set your document root in the file httpd.conf of Apache
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "c:/xampp/htdocs/yii2/web"
<Directory "c:/xampp/htdocs/yii2/web">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>