How to hide frontend/web and backend/web COMPLETELY from url

By: Prem Tiwari | Last Updated: | In: Yii framework


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.

Share this post!


About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


, , , , ,