Page 1 of 1

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

Posted: Tue Mar 07, 2023 12:54 pm
by isscbta
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 some.domain.com and we want that domain to open files from the folder www.domain.com/some

Steps:
1. Add some.domain.com to myVesta
2. In your SSH, as root, run:

Code: Select all

# Creating folder
mkdir /home/user/web/domain.com/public_html/some
chown user:user /home/user/web/domain.com/public_html/some

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

# Delete default public_html folder
rm -rf /home/user/web/some.domain.com/public_html

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


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