There is a way to redirect 404 errors on my main domain or to a customized
page?
System: OpenBSD 5.7-stable i386 with httpd

Not really, because the behaviour is hard coded within httpd:

/usr/src/usr.sbin/httpd/server_http.c :


        /* A CSS stylesheet allows minimal customization by the user */
        style = "body { background-color: white; color: black; font-family: "
            "'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif; }\n"
            "hr { border: 0; border-bottom: 1px dashed; }\n";

        /* Generate simple HTML error document */
        if ((bodylen = asprintf(&body,
            "<!DOCTYPE html>\n"
            "<html>\n"
            "<head>\n"
            "<title>%03d %s</title>\n"
            "<style type=\"text/css\"><!--\n%s\n--></style>\n"
            "</head>\n"
            "<body>\n"
            "<h1>%03d %s</h1>\n"
            "<hr>\n<address>%s</address>\n"
            "</body>\n"
            "</html>\n",
            code, httperr, style, code, httperr, HTTPD_SERVERNAME)) == -1)
                goto done;

        /* Add basic HTTP headers */
        if (asprintf(&httpmsg,
            "HTTP/1.0 %03d %s\r\n"
            "Date: %s\r\n"
            "Server: %s\r\n"
            "Connection: close\r\n"
            "Content-Type: text/html\r\n"
            "Content-Length: %d\r\n"
            "%s"
            "\r\n"
            "%s",
            code, httperr, tmbuf, HTTPD_SERVERNAME, bodylen,
            extraheader == NULL ? "" : extraheader,
            desc->http_method == HTTP_METHOD_HEAD ? "" : body) == -1)
                goto done;


If you just want some simple customization, then you could modify this file, 
and recompile a customised httpd.

I'm actually working on a few patches to allow this, and also simple URL 
re-writing.  For example calling a single script to handle all URLs under a 
specific path.

E.G.

http://www.example.com/foo/<ANYTHING>

All to call a specific script, and pass the URL to it, so that content can be 
generated dymanically based on the URL.

--
Tati Chevron
Perl and FORTRAN specialist.
SWABSIT development and migration department.
http://www.swabsit.com

Reply via email to