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

By Prem Tiwari in Yii framework. Updated on


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.

Sharing is caring!


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

You might also like:

Tags: , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.