[OT] absolute vs. relative URI

Chris Angelico rosuav at gmail.com
Fri Jan 23 18:55:37 CET 2015


On Sat, Jan 24, 2015 at 1:47 AM, Grant Edwards <invalid at invalid.invalid> wrote:
> I'm maintaining a web app were the original author(s) went to a little
> bit of trouble to always use absolute URIs in links in the pages.

The advantage is that someone who downloads the bare page will still
be referencing images, CSS, other links, etc, from the original
server. The disadvantage is... exactly the same. These days, it's MUCH
better to use relative links, and then let something like wget rewrite
them as necessary. In fact, if all your links are relative (not even
the leading slash - use ../../../ as many times as is necessary), they
don't even need rewriting, and you can test your web site by just
pointing your browser at the file system.

The original code seems rather fragile. The port number isn't
incorporated, so incoming requests on 8443 will end up going through
to https:// with the default port of 443. Any other port will be sent
back through 80. Strongly recommend not doing this.

ChrisA



More information about the Python-list mailing list