How to apply Apache directives to 'dynamic' HTML?

Chris G cl at isbd.net
Wed Oct 10 07:44:05 UTC 2007


On Tue, Oct 09, 2007 at 04:27:42PM -0500, Arthur Pemberton wrote:
> On 10/9/07, Chris G <cl at isbd.net> wrote:
> > On Tue, Oct 09, 2007 at 04:13:11PM -0500, Arthur Pemberton wrote:
> > > On 10/9/07, Chris G <cl at isbd.net> wrote:
> > > > I am using the default apache 2.2 configuration in Fedora 7 as server
> > > > on my home Linux box.  It's all working much as I want but I have one
> > > > issue that I can't find any really straightforward information about.
> > > >
> > > > How does one apply apache directives to web pages that are generated
> > > > by a CGI script?
> > > >
> > > > I am running pyBlosxom (a python blog server) as a blog for personal
> > > > notes, I want to set the default character set for only the blog pages
> > > > to iso-8859-1 rather than the default utf-8.  How do I do this?
> > > >
> > > > If it was just simple HTML then I'd do something like:-
> > > >
> > > > <Directory /the/directory/with/html/files>
> > > >     AddDefaultCharset ISO-8859-1
> > > > </Directory>
> > > >
> > > > (I think!)  However I don't see how to apply this to files which are
> > > > dynamically served by a CGI script, i.e. the URL is something like:-
> > > >
> > > >     http://my.home.system/cgi-bin/pyblosxom.py/wiki/directory/file
> > > >
> > > > What (if anything) do I put in the <Directory ....>?
> > >
> > >
> > > You can set ENV variables fron Apache config... don't know
> > > how...Google should know.
> > >
> > How does that help?
> 
> Your CGI script could then read the ENV variable and set the charset itself
> 
The CGI *already* sets ISO-8859-1, the problem is that the apache
server overrides the ISO-8859-1 setting and when viewed in a browser
the charset defaults to UTF-8.

What I want to do is to get apache to set the charset to ISO-8859-1
just for the one directory hierarchy.  By default on Fedora 7 the
apache httpd.conf file has:-

    AddDefaultCharset UTF-8

which sets UTF-8 for *everything* served by that apache installation
regardless of what's in the HTML (however generated).

-- 
Chris Green




More information about the fedora-list mailing list