2

I'm curious as to what most people's views are on this subject. Personally, I will almost always prefer symlinks unless I have no other option -- I find that it is far more obvious when someone is navigating the file system, but, on the other hand aliasing is more platform independent. Windows XP, for example, doesn't have anything remotely comparable to symlinks (NTFS junctions are not interpreted correctly by at least some environments), which means that anything which relies on symlinks in a *nix based system cannot be transferred. (I know that Windows 64x OS's have symlinks, but I've not seen if they can be read correctly by the environments previously mentioned)

In addition to this, I was also wondering which is considered faster. Is this even possible to know? Do you have a conjecture? I would imagine that since symlinks are generally more low-level than Apache it would make sense that they would be referenced faster, but, on the other hand, I would guess that Apache is required to do a lookup in either case so it would be disk read dependent.

cwallenpoole
  • 325
  • 2
  • 13

2 Answers2

4

An alias contains two pieces of information: a unique identifier of the file it links to, and the path and file name of the file it links to.

If you rename or move a file, and then create a new file with the path and file name that the file originally had, then any alias that linked to the original file now links to the new file.

However, if you rename or move a file without replacing it, and then invoke an alias, the alias is updated to point to the new path and file name, making use of the unique identifier to do so.

A symbolic link, on the other hand, does not contain a unique identifier to a file, and would appear as broken if the file is renamed or moved and not replaced with a file of the same path and file name.

Your choice should depend on which scenario suits you best.

Matias Dominoni
  • 337
  • 1
  • 4
2

I generally prefer aliases, because symlinks rely on the generalization that one URL corresponds directly to one filesystem path. This used to generally be the case, but because of the prevalence of search engine-friendly URLs in most web applications, some of which do some fairly sophisticated routing, the document root is rarely the first place I'll check in order to figure out where a URL is going.

jgoldschrafe
  • 4,385
  • 17
  • 18