For Web Hosting instances that run the Linux operating system, the default website root directory is /htdocs. However, some applications, such as those built with the ThinkPHP framework, use /public as their default directory. Before you upload your website application, change the website root directory in the Web Hosting console to match the default directory required by your application. This change ensures that your website is accessible. This topic uses ThinkPHP as an example to demonstrate this process.
Limitations
This topic applies only to Web Hosting instances that run the Linux operating system. The ability to change the website root directory depends on the product type:
-
You can change the website root directory on Enhanced Web Hosting instances that run the Linux operating system.
-
Some non-Enhanced editions of Web Hosting that run the Linux operating system support changing the website root directory. The availability of this feature is indicated in the Web Hosting console.
Procedure
Before you begin, make sure that you have installed an FTP client. We recommend using FileZilla. Click FileZilla to download the tool.
-
Use an FTP client to connect to your Web Hosting instance.
For more information, see Manage website program files by using FileZilla.
-
Verify that the
/htdocs/publicdirectory exists.-
If the directory exists, proceed to the next step.
-
If the directory does not exist, right-click a blank area in the
/htdocsdirectory, clickCreate directory, enterpublicas the directory name in the dialog box, and then clickOK.
-
- Log on to the Cloud Web Hosting management page.
- Find the Cloud Web Hosting instance that you want to manage and click Manage in the Actions column.
- In the navigation pane on the left, choose .
-
On the change website root directory page, confirm that the current website root directory is htdocs, and then click change website root directory.
In the navigation pane on the left, choose basic environment settings > change website root directory to open the page.
- In the dialog box that appears, click Confirm.
Results
-
If the change is successful, the current website root directory field displays htdocs/public.
-
If the change fails, an error dialog box appears. Follow the on-screen instructions to re-create the/htdocs/public directory and try changing the website root directory again.
References
For Web Hosting instances that run the Linux operating system, if you cannot find the/htdocs directory when using the file manager, see Cannot find the htdocs directory on the File Manager page for possible causes and solutions.