If your only goal is to achieve not ever seeing /frontend/web or /backend/web, even without using .htaccess rules, you could go for the following. Before procees make sure your directory structure would look like :

- yii2app/
- frontend/
- backend/
- common/
- .. other folders..
- admin/
- assets/
- css/
- index.php
- assets/
- css/
- index.php

yii2-default

Your yii2app/index.php would then look like:

Go to root directory of your Yii2 application and create index.php page like : yii2aap/index.php then copy bellow code snippets and paste in your page and save it.

and your yii2app/admin/index.php would look like:

Go to admin directory of your Yii2 application and create index.php page like : yii2aap/admin/index.php then copy bellow code snippets and paste in your page and save it.

After doing above step, then go to the browser and remove frontend and backend from your browser url.

Thank you for giving time on freewebmentor community. Please don’t forget to subscribe our newsletter or join us on Facebook to be the first to learn the next great thing from freewebmentor.