How to point webroot to another folder (instead of public_html)

Post Reply
User avatar
Team Member
Posts: 129
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 14 times
Been thanked: 3 times

What is a Symbolic link:
In Linux, a symbolic link (also known as a symlink or soft link) is a file that points to other files or directories by representing their absolute or relative path. It's similar to shortcuts in Windows and provides a convenient way to access files or folders with long paths quickly.

How to point webroot to another folder (instead of public_html) :

For example, we added and we want that domain to open files from the folder

1. Add to myVesta
2. In your SSH, as root, run:

Code: Select all

# Creating folder
mkdir /home/user/web/
chown user:user /home/user/web/

# Optionally: moving everyithing from old public_html to new webroot:
rsync -a /home/user/web/ /home/user/web/

# Delete default public_html folder
rm -rf /home/user/web/

# Creating of a symbolic link
ln -s /home/user/web/ /home/user/web/
chown -h user:user /home/user/web/
So the conclusion is, after those steps - folder /home/user/web/ is symlinking to /home/user/web/

Another way to do this is to use v-move-folder-and-make-symlink command: viewtopic.php?t=767

Post Reply