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
newpublicthat will be our new webroot:
Navigate to home directory of your site with:
- 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:
Give us your feedback on this article
Did this help you?
Servebolt has launched Accelerated Domains!
Accelerated Domains is a service that greatly improves and optimizes your site on these four areas: Performance, Scalability, Security and the Carbon footprint of your website.