If you want to point one folder to another directory, for example to define root directory for your website you can create symlink. 

 

 

Let's take an example, we have a Laravel application and we want to point our web server public_html or www folder to laravel/public folder. So, every time when user opens our homepage it will end up in Laravel public folder.

1. create Laravel app folder, open terminal go to your directory and run this:

                    mk dir laravel-app
                  

Place your Laravel files inside of that folder

 

2. Usually public_html folder is pointing to your website root directory, but in same cases this directory can be named www. So, let's remove public_html or rename public_html directory on your server:

                    // rename directory
mv public_html public_html_ // rename public_html to public_html_
// or remove 
rm -r public_html // remove public_html completely
                  

3. create symlink to point from public_html  to laravel-app/public :

                    ln -s /home/app/laravel-app/public public_html     // ln -s PATH_TO_NEW_DIRECTORY SYMLINK_NAME
                  

symlink is created, and now you can double check it by entering command ll in terminal

                    ll
// output should be somtehing like:    public_html -> /home/app/laravel-app/public

                  

 

And that's all folks 🐇