473,387 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get which non-existend page led to error404.php


Hi,

I have my error404.php page which includes
these lines:

echo "Document not found...";
echo $_SERVER['REDIRECT_URL'];

I also created a dummy link on another page, something
like

<a href=http://example.com/dummylinktogotoerrorpage>dummy</a>

When I click on the link I go to the error page
however all I see is:

Document not found.../error404.php

But I expected to see what caused the error, so that I can
record it to see if somebody is referring to some non-existent
pages on my site.

I used $_SERVER['REDIRECT_URL'] because of this O'Reilly
article: http://www.onlamp.com/pub/a/onlamp/2...avidsklar.html

Unfortunately either I miss something, or the article does not
give correct info (or something's stragen with the configuration
of the Apache at my hosting service).

Any ideas? What should I check? Why $_SERVER['REDIRECT_URL'] hold
the value "/error404.php"? How can I find the value
I'm looking for?

Thanks in advance.

--
Emre Sevinc

eMBA Software Developer Actively engaged in:
http:www.bilgi.edu.tr http://ileriseviye.org
http://www.bilgi.edu.tr http://fazlamesai.net
Cognitive Science Student http://cazci.com
http://www.cogsci.boun.edu.tr
Jul 17 '05 #1
5 1462
Emre Sevinc wrote:
Any ideas? What should I check? Why $_SERVER['REDIRECT_URL'] hold
the value "/error404.php"? How can I find the value
I'm looking for?


$_SERVER['REQUEST_URI']
JW


Jul 17 '05 #2
"Janwillem Borleffs" <jw@jwscripts.com> writes:
Emre Sevinc wrote:
Any ideas? What should I check? Why $_SERVER['REDIRECT_URL'] hold
the value "/error404.php"? How can I find the value
I'm looking for?


$_SERVER['REQUEST_URI']


Modified the code:

echo "Document not found...\n<br>";
echo $_SERVER['REDIRECT_URL'] . "<br>";
echo $_SERVER['REQUEST_URI'] . "<br>";

Then clicked on a dummy linked on the same site to
reach the error page but I get this output:

Document not found...
/error404.php
/error404.php


--
Emre Sevinc

eMBA Software Developer Actively engaged in:
http:www.bilgi.edu.tr http://ileriseviye.org
http://www.bilgi.edu.tr http://fazlamesai.net
Cognitive Science Student http://cazci.com
http://www.cogsci.boun.edu.tr
Jul 17 '05 #3
Emre Sevinc wrote:
Then clicked on a dummy linked on the same site to
reach the error page but I get this output:

Document not found...
/error404.php
/error404.php


Works for me with an .htaccess file with the ErrorDocument directive
pointing to a PHP file in which $_SERVER['REQUEST_URI'] is printed.

Check your server configuration or use the output of phpinfo() to examin the
environmental variables.
JW

Jul 17 '05 #4
"Janwillem Borleffs" <jw@jwscripts.com> writes:
Emre Sevinc wrote:
Then clicked on a dummy linked on the same site to
reach the error page but I get this output:

Document not found...
/error404.php
/error404.php


Works for me with an .htaccess file with the ErrorDocument directive
pointing to a PHP file in which $_SERVER['REQUEST_URI'] is printed.

Check your server configuration or use the output of phpinfo() to examin the
environmental variables.


"echo"ing phpinfo() created an output like the one you can see
at the end of my message.

All I did was to use the web control panel of my hosting
service, enter the addres of my error404.php as the error page
and then enter the code that I described there and upload my newly
created error404.php file there. No matter what I did I couldn't get
the dummy link's name. Strange but that's what I have. Can it be something
with the configuration?

================================================== ======================
PHP Version 4.3.10

System Linux linux01 2.4.24 #1 SMP Tue Aug 10 00:10:23 EEST 2004 i686

Build Date Dec 22 2004 17:45:02

Configure Command './configure'
'--prefix=/sys/php-4.3.10-apache-1.3.33'
'--with-apxs=/sys/apache-1.3.33/bin/apxs'
'--with-mysql=/mysql/'
'--with-curl=/sys/curl-7.11.1/'
'--enable-ftp' '--enable-safe-mode'
'--with-gd' '--with-xpm-dir' '--with-ttf'
'--with-jpeg-dir' '--with-png-dir' '--enable-gd-native-ttf'
'--with-freetype-dir=/usr/include/freetype2/' '--with-xpm'
'--with-png-dir' '--with-zlib-dir'
'--with-zlib' '--enable-calendar'
'--with-gettext' '--enable-track-vars'
'--with-config-file-path=/apache/conf/' '--enable-exif'
'--enable-sockets' '--with-openssl'

Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /sys/apache_standart/conf/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
Debug Build no
Thread Safety disabled
Registered PHP Streams php, http, ftp, https, ftps, compress.zlib
================================================== =========================
--
Emre Sevinc

eMBA Software Developer Actively engaged in:
http:www.bilgi.edu.tr http://ileriseviye.org
http://www.bilgi.edu.tr http://fazlamesai.net
Cognitive Science Student http://cazci.com
http://www.cogsci.boun.edu.tr
Jul 17 '05 #5
Emre Sevinc wrote:
All I did was to use the web control panel of my hosting
service, enter the addres of my error404.php as the error page
and then enter the code that I described there and upload my newly
created error404.php file there. No matter what I did I couldn't get
the dummy link's name. Strange but that's what I have. Can it be
something with the configuration?


It sure has to do with the server configuration. Possibly, erroneous
requests are redirected with a regular 301/302 response code, which would
explain why you get the error page itself as the value of
$_SERVER['REQUEST_URI']. Ask your provider for more info.
JW

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
5
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence...
25
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
32
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
11
by: ypjofficial | last post by:
Hello All, So far I have been reading that in case of a polymorphic class ( having at least one virtual function in it), the virtual function call get resolved at run time and during that the...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
12
by: puzzlecracker | last post by:
is it even possible or/and there is a better alternative to accept input in a nonblocking manner?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.