Sometimes you may want to move a file or directory out of your main website structure, this could be for a number of different reasons but a common one would be to prevent files being lost (for example your sites media/uploads directory) in a site upgrade.
This can be accomplished by creating a symbolic link, also known as a symlink, between the location you want your directory to be stored and the spot where it should be.
I am going to use the example of a Magento
media folder which I am going to moved outside of the
http directory and will create a symlink for it.
cd path/to/magento/root/http ln -s ../media media
Simple, all we do is first put the location of the folder (or file) and then name it in this location.
In doing this we could have renamed the directory in the external location to say
___media but it doesn’t matter as long as the symlink itself is still called