Symbolic Links: from intended dir only

I had much trouble making symbolic links work for my web site. After a bit of investigation, I finally realized the problem: symbolic links with relative paths must be made from within the directory they well be in, i.e. ln -s path/to/file linkname. This means you must cd into the directory the link will be in before making the link. Otherwise, the link will not work properly. This is because the path stored in the link is exactly the one you feed into ln. For example, if you type ln -s . /Users/bob/ in a different directory than bob, would point to ., AKA bob, which may not be the intention. On websites, such things will lead to a 403 forbidden error no matter what the permissions are. In the finder, the link will not work.

This helped me out a lot for my calendar, for which I needed to point it to the iCal .ics files. Since Apple moved the files into individual folders, I couldn’t just point my phpicalendar to that folder; I had to make symbolic links to each file. The alternative to this would require me to manually synchronize two copies of the file, which would be undesirable.

[Update 2016/09/01]Clarified some things based on increased knowledge[/Update]

Published by


I am a quiet person from Northeast Ohio. I work as a web developer. I like computers, music, and many other things.

Leave a Reply

Your email address will not be published. Required fields are marked *