[TAG] Two-cent tip for Linux Gazette

Ben Okopnik ben at linuxgazette.net
Fri Sep 12 21:01:04 MSD 2008


On Fri, Sep 12, 2008 at 05:33:05PM +0100, Silas S. Brown wrote:
> Hi Ben,
> 
> On Fri, Sep 12, 2008 at 10:52:16AM -0400, Ben Okopnik wrote:
> > >   echo "<A HREF=\"./?zip\">Download $Filename</A>"
> > I'm afraid that's not going to work: the above link will produce a URL
> > that follows the current _directory_ name with the query string, whereas
> > what you need is the current _scriptname_ followed by "?zip".
> 
> That's correct if you're running it as a normal CGI script, but not
> if you're running it as a Mathopd AutoIndexCommand as I suggested.
> With AutoIndexCommand, the script is run for ANY directory that
> doesn't have an index.html, so you don't have to copy the script
> into every subdirectory.  In this case, you DON'T want to point the
> URL to the script itself, because the script itself is probably in
> a different directory from the one being listed.  You want to point
> the URL back to the directory, so that, next time the script is
> called by AutoIndexCommand, it's in the right directory to make the
> zip file.  Otherwise, it would be in the script directory instead,
> which may be different.
> 
> I have tested this, honest :)
 
Oh, I believe you. :) I've never used Mathopd, myself, but there are
directives you can use in, say, Apache that would do something like
that, too. On the other hand, making the script server-independent has
its attractions too.


-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *




More information about the TAG mailing list