How to modify the default document root directory path of a web domain name in HestiaCP? Customize the home directory of a website

HestiaCP Modify the domain name root directory and bind it easilyWordpressImage subdomain, website will be improved rapidly! 🚀

Want to change the default root directory path of the web domain name in HestiaCP?

This article provides you with a detailed guide that even a novice can easily handle!

The steps are simple and easy to understand, allowing you to quickly master the custom settings of HestiaCP and improve your website management efficiency!

Use HestiaCP to modify the default document root directory path of the Web domain

Have you ever tried to set up an images subdomain for your WordPress site on HestiaCP, only to get a “folder does not exist” error?

You are not the only one who has encountered this problem. Many users have been troubled by this problem when using the HestiaCP control panel.

Now we will solve it step by step, allowing you to easily modify the default document root directory path of the web domain name and upload plugins and themes smoothly!

Why do you need to change the default document root?

By default, HestiaCP will point all domain names to /home/用户名/web/域名/public_html/ table of Contents.

However, if you want to store the images of your WordPress site in a subdomain path, such as img.chenweiliang.com, and hope it points to /home/用户名/web/chenweiliang.com/public_html/wp-content/img.chenweiliang.com/ folder, you need to modify the default document root directory.

Problem: Folder does not exist error

When you try to set it up directly in HestiaCP, you may encounter the following error message:

Error: Directory wp-content/img.chenweiliang.com does not exist under /home/用户名/web/img.chenweiliang.com/public_html/.

How to modify the default document root directory path of a web domain name in HestiaCP? Customize the home directory of a website

  • This is because the system /home/用户名/web/img.chenweiliang.com/public_html/ Not found in directory wp-content/img.chenweiliang.com folder.

How to solve?

Step 1: Create a target folder

First, we need to manually create the target folder.

Log into your server using SSH and execute the following command:

mkdir /home/用户名/web/chenweiliang.com/public_html/wp-content/img.chenweiliang.com

Please remember to replace "username" and "chenweiliang.com" with your own username and domain name.

Step 2: Modify the default document root directory

Next, we need to modify the default document root using the commands provided by HestiaCP.

Execute the following command:

v-change-web-domain-docroot 用户名 img.chenweiliang.com  chenweiliang.com wp-content/img.chenweiliang.com

Again, please replace "username", "img.chenweiliang.com", and "chenweiliang.com" with your own information.

Step 3: Verify that the modification is successful

After completing the above steps, log in to your HestiaCP control panel and view the subdomain img.chenweiliang.com Has the default root directory been changed to:

wp-content/chenweiliang.com

, log in to your HestiaCP control panel and check whether the default root directory of the subdomain img.chenweiliang.com has been changed to: wp-content/chenweiliang.com

Step 4: Move files

Finally, move all of your image files into the newly created folder:

mv /home/用户名/web/img.chenweiliang.com/public_html/* /home/用户名/web/chenweiliang.com/public_html/wp-content/img.chenweiliang.com/

v-change-web-domain-docroot command detailed explanation

This command looks complicated, but it's actually very simple!

Let’s break it down:

  • v-change-web-domain-docroot: This is the command itself, which is used to change the default document root directory of a web domain.

  • 用户名: The username of the domain you wish to change.

  • img.chenweiliang.com: The source domain for which you want to change to a different document root.

  • chenweiliang.com: Target domain, specify the public_html folder of the target domain.

  • wp-content/img.chenweiliang.com: The target directory, which is the directory inside the public_html folder of the target domain.

Some examples:

  • Setting img.chenweiliang.com 使用 /home/用户名/web/chenweiliang.com/public_html/ As its document root:
v-change-web-domain-docroot 用户名 img.chenweiliang.com  chenweiliang.com
  • Setting img.chenweiliang.com 使用 /home/用户名/web/chenweiliang.com/public_html/wp-content/img.chenweiliang.com/ As its document root:
v-change-web-domain-docroot 用户名 img.chenweiliang.com  chenweiliang.com wp-content/img.chenweiliang.com
  • Setting img.chenweiliang.com 使用 /home/用户名/web/img.chenweiliang.com/public_html/wp-content/img.chenweiliang.com/ As its document root:
v-change-web-domain-docroot 用户名 img.chenweiliang.com  img.chenweiliang.com wp-content/img.chenweiliang.com
  • 恢复 img.chenweiliang.com The default root directory /home/用户名/web/img.chenweiliang.com/public_html/ :
v-change-web-domain-docroot 用户名 img.chenweiliang.com default

Final Thoughts

By following the above steps, you have successfully modified the default document root directory of the web domain name!

Now you can easily store images on your WordPress site on a subdomain and avoid “folder does not exist” errors.

I hope this article helps you.

If you have any other questions, please leave a message in the comment area or refer to the official HestiaCP documentation.

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) Shared "How to modify the default document root directory path of the web domain name in HestiaCP? Customize the main directory of the website" may be helpful to you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-31873.html

To unlock more hidden tricks🔑, welcome to join our Telegram channel!

If you like it, please share and like it! Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

Scroll to Top