Our default webroot is named public
. You cannot change the actual webroot, but you can symlink the default (forced) webroot to another folder. This has the same effect, without implications on the rest of our stack. A symlink works as an alias of the webroot.
Steps in this guide include SSH commands. Here’s an article for you when you’re not familiar on how to use login using SSH.
How you can do it:
Time needed: 5 minutes.
Symlink the public folder to the project’s public folder. You can do so with the following steps:
- Make the new folder
Navigate to root and make the folder you want to symlink to. In this case we want to make a new folder called
newpublic
that will be our new webroot:
Navigate to home directory of your site with:cd ~
- Move to the correct folder
Move the public folder to the new folder with:
mv public newpublic
- Symlink new folder
Symlink the new folder to act as your new webroot with this command:
ln -s newpublic public
The new public folder will look something like this: