How to create a symbolic link

When building new projects if I am not using an unbuilt server within a framework such as Symfony I like to keep my code-base separate from the web server that is serving up the content. Its good for security because you are not storing vital pieces of your app in the DMZ (Demilitarized Zone) – in this case a physical folder on the server for all to access. But also it just keeps things nice and tidy.

What is a Symbolic Link?

Symbolic links are often referred to as “soft links” or in the Windows world shortcuts. Quite simply they provide a channel to content that is stored elsewhere without having the same data physically stored in two or more separate places – which would be a nightmare to manage.

How do you create them?

This example uses Linux but the concept is the same for Windows. The structure is as follows

Link the physical contents of this folder to another area I will specify

And that’s all there is to it – so in Linux it would look something like this:

ln -s ~/sites/some_project/ /var/www/html/