[pmwiki-devel] IncludeUpload and relative URLs

Kathryn Andersen kat_lists at katspace.homelinux.org
Fri May 11 18:17:59 CDT 2007

Russ Fink's questions on pmwiki-users have prompted me to wonder if
there's a good solution to the "relative URLs" problem for included
external files.

Problem: including the contents of a HTML file inside a wiki page, if
the included file had relative links (to other files in the place it was
included from) those links are now broken.

To give an example:
There's a file, foo.html, which is at

It contains a link, <a href="bar.html">Bar</a>
which links to pmwiki/uploads/Main/bar.html

So, if one looks at foo.html directly (using
then the link to bar.html will work.

However, if one includes the contents of foo.html inside, say the
Main.Thingy page, then you're looking at
and the bar link will be pointing to
which doesn't exist.

Now, the IncludeUrl recipe solves this problem by embedding the given
page inside the wiki page, rather than including its contents, bypassing
the problem altogether.

However, I don't want to have frames, which is one reason why I wrote
IncludeUpload in the first place.

The only solution I can think of would be to go through the contents of
foo.html and change every relative link into an absolute link before the
contents are included, but that's an awful lot of work, and I'm not sure
I'd get it right.  I'd rather have a simpler solution, if there was one.

Any ideas?

Kathryn Andersen
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe

More information about the pmwiki-devel mailing list