Discussion:
404 Page
(too old to reply)
David E. Ross
2015-08-15 23:11:05 UTC
Permalink
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?
--
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/>
Dedomen
2015-08-16 13:01:52 UTC
Permalink
Post by David E. Ross
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?
David E. Ross
2015-08-16 14:34:57 UTC
Permalink
Post by Dedomen
Post by David E. Ross
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
--
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/>
Dedomen
2015-08-18 10:34:13 UTC
Permalink
Post by David E. Ross
Post by Dedomen
Post by David E. Ross
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
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
David E. Ross
2015-08-18 23:07:46 UTC
Permalink
Post by Dedomen
Post by David E. Ross
Post by Dedomen
Post by David E. Ross
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
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.
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/>
I R A Darth Aggie
2015-09-02 17:25:18 UTC
Permalink
On Tue, 18 Aug 2015 16:07:46 -0700,
Post by David E. Ross
Post by Dedomen
Post by David E. Ross
Post by Dedomen
Post by David E. Ross
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
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.
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
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.
David E. Ross
2015-09-02 19:16:39 UTC
Permalink
Post by I R A Darth Aggie
On Tue, 18 Aug 2015 16:07:46 -0700,
Post by David E. Ross
Post by Dedomen
Post by David E. Ross
Post by Dedomen
Post by David E. Ross
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
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.
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
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.
REQUEST_URI: /cgi-bin/environ.pl
----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/>
Loading...