httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Garrison <>
Subject [users@httpd] Sharing a CGI script from multiple directories?
Date Tue, 29 Oct 2002 05:33:13 GMT
I'm looking for a way to share a single CGI script from many
directories in apache.  I have a Perl CGI script called 'album.cgi'
that generates a photo album (index pages and image pages).  I want
to have various photo albums in different directories, for example:


This is currently running under apache 1.3.27, with a VirtualHost
directive defining the document root as my public_html directory:

    DocumentRoot /home/myuserid/public_html
    BytesLog domlogs/
    User myuserid
    Group mygroupid
    CustomLog domlogs/ combined
    ScriptAlias /cgi-bin/ /home/myuserid/public_html/cgi-bin/

/home/myuserid/public_html/.htaccess contains:

    Options -Indexes +ExecCGI +FollowSymLinks
    DirectoryIndex album.cgi index.html index.cgi

What I want to have happen is the following:

1) User browses to, for example,

2) Apache looks in album1/.htaccess for album-specific
    authentication requirements (may or may not be present).

3) Apache then invokes a single shared copy of album.cgi
    to generate the album index page

So far, the only way I've been able to make this work is to put a
copy of album.cgi, or a hard link to the one in public_html/cgi-bin,
in each album directory. I want to avoid duplicate copies or hard
links if possible.

Symbolic links would be acceptable, and I tried them yesterday. It
worked fine for one day, and then my ISP changed something and it
quit working.

I suspect there's probably a much better way to do this than what
I've tried so far. How would an apache guru fulfill the requirments
stated above? Some form of URL rewriting?  Any suggestions on how to
proceed?  Pointers to existing solutions?

Thanks in advance.
Jim Garrison (
PGP Keys at RSA 0x04B73B7F DH 0x70738D88

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message