Yii Advanced Application Frontend & Backend Urls
Posted 26 August 2013 - 12:47 PM
I've been following Yii2 since quite some time and after Public Preview thought to give it a try. In particular I liked the advanced application structure and thought to move ahead with it.
However, while installing, realized that accessing frontend & backend is done via
http://example.com/frontend/web/ and http://example.com/backend/web/
Would it be possible to have them as
http://example.com/ (pointing to frontend) and http://example.com/backend/
Posted 26 August 2013 - 01:26 PM
You'll also need to modify require() dirs inside index.php
Yet another way is to place all dirs under webroot and edit .htaccess so that webroot will be rewrited to subdir. Kinda tricky though.
Posted 27 August 2013 - 12:03 AM
It will mean I'm placing backend directory under frontend/web. right?
.htaccess based solution could be tricky to manage for sure.
Is it that the directory structure is decided to have two separate domain / sub-domains pointing to both the applications?
Posted Today, 05:55 AM
Released a new application template yii2-app-practical to the community that does this automatically.
Posted Today, 06:24 AM
Not sure I understood. Which source code (can you elaborate)?
Only the index.php will move to webroot (along with the runtime assets folder from the frontend/web). All other structure remain exactly the same as the yii2-advanced app (the same security should hold good IMO). Its only config file locations change.
Posted Today, 06:42 AM
- moves frontend/web/index.php, favicon, and robots.txt to root.
- moves frontend/web/assets to root.
- deletes frontend/web folder
- carefully changes index.php configuration locations to point to the new relative vendor, common, and frontend paths.
And voila... you can now access frontend from the approot.