Moving an application webroot
By default, Yii2 applications work from the web
directory for your site's entry script. But shared hosting environments are often quite limited when it comes to the configuration and directory structure. You cannot change the working directory for your site. Most servers provide only the public_html
directory for your site entry scripts.
Getting ready
Create a new yii2-app-basic
application by using the Composer package manager, as described in the official guide at http://www.yiiframework.com/doc-2.0/guidestart-installation.html.
How to do it...
Let's discuss the ways to move an application webroot.
Placing files in the root
- Upload the application files into your hosting.
- Rename the
web
directory topublic_html
. - Check that the site works correctly.
Placing files in a subdirectory
A hosting user directory may contain other files and folders. Here's how you can move files to a subdirectory:
- Create the
application
andpublic_html
directories. - Move the application...