Problem with ln command

This supplement to the document about putting course material on the web deals with a potential problem with the ln command.

Question from user xyz


My pages have many links to various files in a tree of directories, which I
access using relative pathnames (e.g., ../../file).
However, the link command interprets the paths as being relative
to the target name, so all these links are lost. At the same time
absolute pathnames seem to depend on which machine you log on
(/misc/network/xyz/..., /napier/network/xyz/..., etc).

I tried a few of them, together with ~/xyz/...  $HOME/xyz/... ,
without success.

There must be an easy trick; do you know how to solve this problem?

Answer

Sorry, I completely overlooked that problem.  Here are two possible
solutions.

1.  Use redirection instead of a symbolic link; see ~fjw/public_html/MAS212
for an example.  This redirects to a different server, whereas you just need
to redirect to a different file.

2.  Try including a <base> header element in your main course page files.
For your MAS233 file the following should work:

<head>
...
<base http://www.maths.qmul.ac.uk/~xyz/teaching/>
...
</head>

This just rebases all the relative URLs in the document.  This shorter
version should also work:

<base http:~xyz/teaching/>