I’m pretty new to yii and this is my first time posting in the forum. I’m using yiiboilerplate for my application and I’m running into some issues. I have everything working locally, but I’m not sure how to get it working on my server. I would be fine with using subdomains for now, so frontend.website.com and backend.website.com would be fine for now. I’m not sure how to point to the frontend and backend www folders or where the the other files should go on the server. I did some searching, but couldn’t find a definitive answer and I would like to know the proper way to set this up. Any help would be greatly appreciated. Thank you in advance.
The first line in the example code above is quite important, it changes current directory to the “root” directory where you will copy/install the application files, and the following lines will load required files from subdirectories of the “root” directory (for security reasons, all these directories except www should be put in different place other than public access directory). So you can actually put www directory anywhere, as long as you can locate the “root” directory and load the files that Yii requires, then your website will be able to run. For example you can put all files in www directory to public_html in your server, thus you don’t need to setup subdomain for frontend.
The same method applies for backend/www, you can put all the files in -for example- public_html/admin, so you can access the admin via yourwebsite.com/admin. But, if you want to setup a subdomain, you can set it up in the control panel of your host to point to www directory.
Thank you for responding. I haven’t had a chance to give it a try, but what you said makes sense. Definitely appreciate the help. Hopefully I can give it a shot this weekend.
I have finally gotten around to giving this a shot and I’m confued on a few things. Here is what I would like to do:
public_html/www/frontend
public_html/www/backend
So that when I got to frontend.website.com it takes me to the frontend and backend.website.com takes me to the backend. Should I still put the www folder in frontend and backend respectively? Do the common and console directories just go into public_html/www/?
I assumed you are in a shared hosting where you don’t have access to the webserver configuration. If so, you can setup your app directory like below (note: the directory in your server might be slightly different):
/home
/user
/frontend
/components
/config
/extensions
/models
/controllers
/views
/ (other frontend subdirectories)
/backend
/components
/config
/extensions
/models
/controllers
/views
/ (other backend subdirectories)
/common
/components
/config
/extensions
/models
/ (other common subdirectories)
/public_html
/frontend -> put all files from /frontend/www here
/backend -> put all files from /backend/www here
you need to edit index.php in /public_html/frontend and in /public_html/backend as I told you in my previous post. Using this way, your application files stay behind public_html (more secured) and you can setup subdomain as frontend.website.com and backend.website.com.