[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

C. Absolute and Relative URIs

LinkController is designed to handle absolute and relative URIs in a consistent but sensible fasion, but unfortunately there isn't any totally clear correct way. For link extraction we simply conver relative URLs to absolute form. For link testing, this means that we don't ever think of relative URLs. For link fixing on the other hand the situation is more complex. For this reason there is a --relative option to fix-link.

If we run fix-link without the --relative option then we only substitute absolute links in the existing document to the link given on the command line. This is safer because the subsitution is unlikely to mistake other strings which accidentally match the link.

If we run fix-link with the --relative option on the other hand then we will handle relative links. What this means depends on whether the links to be fixed can be expressed as links relative to the pages being fixed.

If the original (broken) link can be expressed as a relative link then we will do substitutions where we find relative links. If the target (corrected) link can be expressed as a relative link then we will always substitute broken links with a relative link.

Taken together, this means that if a resource has moved to the same server as your pages, substitution with the --relative option will correction convert all of your absolute links into relative links and if a resource has moved from your server to another then we will correctly substitute relative links with absolute links.

The only undesirable effect would be if a resource is moved within your pages and you have a mixture of relative and absolute links to that resource (e.g. for absolute links on page which is mirrored on other sites). In this case, first do substitution without the --relative option and then afterwards with the --relative option.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Michael De La Rue on February, 3 2002 using texi2html