Symbolic Linking

  |   Source


ln -s /original/file /new/link

This will create a link between the two files (or directories). Whatever you do: add, change or delete in one will happen in the other.

So, if you had a website in a dev directory in your home directory ie ~/dev/websites/mynewwebsite and Apache is installed and you want to view it through a brower. And you don't want to create a virtual host file and put an entry in the /etc/hosts file.

  1. The default "webroot" is at /var/www (check the documentation)

  2. You will need to do this as root (su - and enter password or prepend sudo to this command because the directory /var/www is owned by root):

    ln -s ~/dev/websites/mynewwebsite /var/www/mynewwebsite

You can now access the website through http://localhost/mynewwebsite

Comments powered by Disqus