Re: standard error page per virtual host

Juergen Daubert <[email protected]> Thu, 13 May 2010 10:56:43 +0200
Newsgroups gmane.network.mathopd
Message-ID <[email protected]>
On Wed, May 12, 2010 at 02:04:27PM +0200, Lars T=E4uber wrote:
> Hi there!

Hello,

>=20
> I'm new to mathopd but I thought it could serve all my wishes.
>=20
> The question is: Does mathopd support setting standard error pages?

Yes, see http://www.mathopd.org/wiki?ErrorFile

> I have a small energy saving webserver that still runs when all other=20
> webservers are shut down due to power out. This server is backuped by a=
n ups.
> It will be configured to take over the ip addresses of the shut down=20
> webservers and should serve a single static webpage for each virtual ho=
st=20
> configuration.
>=20
> The question is can mathopd redirect all requests to a single html file=
?
>=20
> e.g.
>=20
> http://abc.domain.org/xyz/file.html=20
> should not generate a 404 error page but reply the standard file:
> /srv/www/abc.domain.org/index.html

Setup virtual hosts and use the Error404File directive within a Control
block:

 Virtual {
     Control {=20
         Host abc.domain.org
         Alias /
         Location /srv/www/abc.domain.org/index.html
         Error404File /srv/www/abc.domain.org/index.html
     }
 }

Unfortunately you have to do that for every host, because Error404File
cannot expand the * wildcard like Location does, see the Location
wiki-page to see what I mean: http://www.mathopd.org/wiki?Location

One possibility to solve this might be to use a CGI script insatead of=20
a static page for Error404File that reads the REQUEST_URI environment=20
variables and redirects the user to the right error-page.=20
See http://www.mathopd.org/wiki?CGI/EnvironmentVariables


HTH and regards
Juergen

--=20
Juergen Daubert  |  mailto:[email protected] =20