On Wednesday 02 July 2003 17:48, Brian Candler wrote:
> > Here's the challenge:
> > ---------------------------
> > When I open this URL:
> >
> > http://cvsup.wingnet.net/cgi-bin/sqwebmail-alt-template
> >
> > I want to set the SQWEBMAIL_TEMPLATEDIR environment variable
> > and launch sqwebmail.
>
> This is really an Apache question, but...


I don't feel any guilt about asking on this list. I plan to write some sqwebmail
documentation on the matter when I'm done, so I think it's on topic.

>
> You can certainly do this with mod_rewrite. (I do something similar, except
> I have a complete virtual hosting config based on mod_rewrite, with no
> <VirtualHost> entries)
>
> You can probably also do it with something like:
>
>   ScriptAlias "/cgi-bin/sqwebmail-alt-template" "/path/to/sqwebmail"
>
>   <Location /cgi-bin/sqwebmail-alt-template>
>     SetEnv SQWEBMAIL_TEMPLATEDIR /x/y/z
>   </Location>


The above is ideal, but at first I couldn't get the ScriptAlias to work.
I had to use a symlink or hardlink in the /cgi-bin directory to acheive
the same effect.

However, I prefer to keep everything in the httpd.conf file, rather than
having to also create a symlink, so I kept at it and tried some
mod_rewrite stuff (which I also couldn't get to work the exact way I
wanted).

Later, I went back and moved the ScriptAlias statement above my:

    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

And it worked!

So I now have this:
-------------------
    # Sqwebmail Alternate Template URL
    ScriptAlias /cgi-bin/sqwebmail-alt-template "/usr/local/apache/cgi-bin/sqwebmail"

    <Location /cgi-bin/sqwebmail-alt-template>

        Setenv SQWEBMAIL_TEMPLATEDIR "/usr/local/share/sqwebmail/html.bak"
        Options FollowSymlinks
        Order allow,deny
        Allow from all
    </Location>

    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

    #
    # "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    #
    <Directory "/usr/local/apache/cgi-bin">
        AllowOverride None
        Options FollowSymLinks
        Order allow,deny
        Allow from all
    </Directory>
-------------------

/usr/local/share/sqwebmail/html.bak is just where I'm pulling an alternate
template from at the moment. Replace that with any template dir.

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net



Reply via email to