• 404 Page

    From David E. Ross@21:1/5 to Dedomen on Tue Aug 18 16:07:46 2015
    On 8/18/2015 3:34 AM, Dedomen wrote:
    On Sun, 16 Aug 2015, David E. Ross wrote:

    On 8/16/2015 6:01 AM, Dedomen wrote:
    On Sat, 15 Aug 2015, David E. Ross wrote:

    I am trying to create my own 404 page. When someone requests a
    non-existent Web page from my domain, what environment variable contains >>>> the requested path to the page?

    You are using apache, nginx or something else?


    Server: Apache/2.2.29
    OS: Unix

    Mods:
    mod_ssl/2.2.29
    OpenSSL/1.0.1e-fips
    mod_bwlimited/1.4
    mod_perl/2.0.8
    Perl/v5.10.1

    Sorry for the late answer. Creating custom 404 page is trivial in Apache. Here is good tutorial:

    https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache


    I did all that quite some time ago. Yes, my 404 page does appear when
    someone requests a non-existant page.

    What I want, however, is to display the path that the visitor requested.
    For example, someone might request
    http://www.rossde.com/garden/xxyyzz.html
    My 404 page already has coded into it
    Error at <www.rossde.com>
    The next line on the page says
    No Such Web Page:
    where I would want to see
    No Such Web Page: /garden/xxyyzz.html
    For that to work, I need the Apache environment variable that contains
    the path that was requested.

    All this worked with a prior Web host. But that host decided to
    eliminate all consumer accounts, focusing only on commercial accounts.
    I am very frustrated because my current host does not seem to handle server-side includes well.

    --
    David E. Ross

    Why do we tolerate political leaders who
    spend more time belittling hungry children
    than they do trying to fix the problem of
    hunger? <http://mazon.org/>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From I R A Darth Aggie@21:1/5 to mr0ds4$6t8$1@news.albasani.net on Wed Sep 2 17:25:18 2015
    On Tue, 18 Aug 2015 16:07:46 -0700,
    David E. Ross <nobody@nowhere.invalid>, in
    <mr0ds4$6t8$1@news.albasani.net> wrote:
    On 8/18/2015 3:34 AM, Dedomen wrote:
    On Sun, 16 Aug 2015, David E. Ross wrote:

    On 8/16/2015 6:01 AM, Dedomen wrote:
    On Sat, 15 Aug 2015, David E. Ross wrote:

    I am trying to create my own 404 page. When someone requests a
    non-existent Web page from my domain, what environment variable contains >>>> the requested path to the page?

    You are using apache, nginx or something else?


    Server: Apache/2.2.29
    OS: Unix

    Mods:
    mod_ssl/2.2.29
    OpenSSL/1.0.1e-fips
    mod_bwlimited/1.4
    mod_perl/2.0.8
    Perl/v5.10.1

    Sorry for the late answer. Creating custom 404 page is trivial in Apache. Here is good tutorial:

    https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache


    I did all that quite some time ago. Yes, my 404 page does appear when
    someone requests a non-existant page.

    What I want, however, is to display the path that the visitor requested.
    For example, someone might request
    http://www.rossde.com/garden/xxyyzz.html
    My 404 page already has coded into it
    Error at <www.rossde.com>
    The next line on the page says
    No Such Web Page:
    where I would want to see
    No Such Web Page: /garden/xxyyzz.html
    For that to work, I need the Apache environment variable that contains
    the path that was requested.

    All this worked with a prior Web host. But that host decided to
    eliminate all consumer accounts, focusing only on commercial accounts.
    I am very frustrated because my current host does not seem to handle
    server-side includes well.

    You want the REQUEST_URI environmental variable:

    REQUEST_URI: /cgi-bin/environ.pl

    From the following perl cgi script:

    ----snippy------
    #!/usr/bin/perl -- -*-perl-*-
    print qq(Content-Type: text/html\n\n<HTML>
    <HEAD>
    <TITLE>Environmental Variables in CGI</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFF0">
    );
    foreach $key (sort keys %ENV){
    print qq(<strong>$key</strong>: $ENV{$key}<br>\n);
    }
    print "</body>\n";
    ----snippy------

    Which looks like it gives you precisely what you want.

    --
    Consulting Minister for Consultants, DNRC
    I can please only one person per day. Today is not your day. Tomorrow
    isn't looking good, either.
    I am BOFH. Resistance is futile. Your network will be assimilated.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David E. Ross@21:1/5 to I R A Darth Aggie on Wed Sep 2 12:16:39 2015
    On 9/2/2015 10:25 AM, I R A Darth Aggie wrote:
    On Tue, 18 Aug 2015 16:07:46 -0700,
    David E. Ross <nobody@nowhere.invalid>, in
    <mr0ds4$6t8$1@news.albasani.net> wrote:
    On 8/18/2015 3:34 AM, Dedomen wrote:
    On Sun, 16 Aug 2015, David E. Ross wrote:

    On 8/16/2015 6:01 AM, Dedomen wrote:
    On Sat, 15 Aug 2015, David E. Ross wrote:

    I am trying to create my own 404 page. When someone requests a
    non-existent Web page from my domain, what environment variable contains >>>>>> the requested path to the page?

    You are using apache, nginx or something else?


    Server: Apache/2.2.29
    OS: Unix

    Mods:
    mod_ssl/2.2.29
    OpenSSL/1.0.1e-fips
    mod_bwlimited/1.4
    mod_perl/2.0.8
    Perl/v5.10.1

    Sorry for the late answer. Creating custom 404 page is trivial in Apache. >>> Here is good tutorial:

    https://www.digitalocean.com/community/tutorials/how-to-create-a-custom-404-page-in-apache


    I did all that quite some time ago. Yes, my 404 page does appear when
    someone requests a non-existant page.

    What I want, however, is to display the path that the visitor requested.
    For example, someone might request
    http://www.rossde.com/garden/xxyyzz.html
    My 404 page already has coded into it
    Error at <www.rossde.com>
    The next line on the page says
    No Such Web Page:
    where I would want to see
    No Such Web Page: /garden/xxyyzz.html
    For that to work, I need the Apache environment variable that contains
    the path that was requested.

    All this worked with a prior Web host. But that host decided to
    eliminate all consumer accounts, focusing only on commercial accounts.
    I am very frustrated because my current host does not seem to handle
    server-side includes well.

    You want the REQUEST_URI environmental variable:

    REQUEST_URI: /cgi-bin/environ.pl

    From the following perl cgi script:

    ----snippy------
    #!/usr/bin/perl -- -*-perl-*-
    print qq(Content-Type: text/html\n\n<HTML>
    <HEAD>
    <TITLE>Environmental Variables in CGI</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFF0">
    );
    foreach $key (sort keys %ENV){
    print qq(<strong>$key</strong>: $ENV{$key}<br>\n);
    }
    print "</body>\n";
    ----snippy------

    Which looks like it gives you precisely what you want.


    No, REQUEST_URI does not give me what I want.

    Try the following URI, which is a link to a Web page that does not
    exist: <http://www.rossde.com/xxyyzz.html>. That displays my page at <http://www.rossde.com/my404.shtml>.

    The top of that page has the title "Error at <www.rossde.com>", where
    the domain is hard-coded into the HTML. The subtitle should read "No
    Such Web Page: /xxyyzz.html", but instead it has "No Such Web Page: /my404.shtml". This latter is quite wrong since the Web page at not
    only exists but is being displayed.

    The markup for the title and subtitle are:
    <h1>Error at &lt;www.rossde.com&gt;</h1>
    <h2>No Such Web Page: <!--#echo var="REQUEST_URI" --> </h2>

    The Web server information is:
    Server: Apache/2.2.29
    OS: Unix
    Mods:
    mod_ssl/2.2.29
    OpenSSL/1.0.1e-fips
    mod_bwlimited/1.4
    mod_perl/2.0.8
    Perl/v5.10.1

    The permissions on <http://www.rossde.com/my404.shtml> are:
    user: read, write, execute
    group and "world": read, execute

    My .htaccess file contains:
    Options +Includes
    AddHandler cgi-script .ksh
    ErrorDocument 404 http://www.rossde.com/my404.shtml

    --
    David E. Ross

    Why do we tolerate political leaders who
    spend more time belittling hungry children
    than they do trying to fix the problem of
    hunger? <http://mazon.org/>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)