Forum Moderators: phranque

Message Too Old, No Replies

$_SERVER["REDIRECT_URL"] works differently

         

Case

2:08 am on Mar 21, 2006 (gmt 0)

10+ Year Member



I want to use a custom 404 page called 'error.php'.

I have one line in my .htaccess:
ErrorDocument 404 /error.php

In error.php I'm using $_SERVER["REDIRECT_URL"] to show to the URL that resulted in the 404.

On one server this works perfect, it shows the URL requested.

On another server this results in '/error.php'.
I've tried everything, but don't understand why it doesn't work.

Can anyone give me some help here?
Thanks,
Case Stevens

jdMorgan

3:43 am on Mar 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It might be helpful to you to try (temporarily) dumping all the variables in your error document:

<?
phpinfo( INFO_variables );
?>

You might find one that works for your needs across multiple platforms.

There's a lot more PHP expertise over in our PHP forum [webmasterworld.com].

Jim

Key_Master

3:55 am on Mar 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try $_SERVER["REQUEST_URI"]

Case

9:29 am on Mar 21, 2006 (gmt 0)

10+ Year Member



Thanks you both for terrific answers.

The $_SERVER["REQUEST_URI"] did it!

Learned something, much appreciated.
Regards,
Case