Bug #62086 [NEW]: header() in 404 error page
| From: | dave dot kimble at gmx dot com | Date: | Mon, 21 May 2012 07:14:02 +0000 |
| Subject: | Bug #62086 [NEW]: header() in 404 error page | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-170626@lists.php.net to get a copy of this message | ||
From:
Operating system: Win 7 Ult 32
PHP version: 5.4.3
Package: Other web server
Bug Type: Bug
Bug description:header() in 404 error page
Description:
------------
I am trying to redirect all external links to pages in
http://www.*******.org.au/dave.kimble/
to http://www.davekimble.org.au/
by using header() in 404 error page.
Fastream IQWebFTPServer v11.5.5R possibly implicated.
If header() follows echo(), I expect error "headers already written".
Adding echo statements to debug, the output either doesn't appear, or after
<BR> output is the remaining script itself.
Same problem with PHP 5.4.0
Test script:
---------------
Must be set in web server as Error Page 404
<?php
// error page for 404
$uri = $_SERVER['REQUEST_URI'];
if (substr($uri, 0, 12 ) == '/dave.kimble' )
{ $restofuri = substr($uri, 12 );
header('Location: http://www.davekimble.org.au'.$restofuri
);
exit('Redirecting you to http://www.davekimble.org.au'.$restofuri);
}
echo ($uri . ' not found<BR>');
?>
Expected result:
----------------
a) Browser URL: http://test-domain.com/dave.kimble/index.htm
should return page http://www.davekimble.org.au/index.htm
b) Browser URL: http://test-domain.com/xxxx.xxx
should return "/xxxx.xxx not found"
Actual result:
--------------
a) Browser URL: http://test-domain.com/dave.kimble/index.htm
returns blank page and response status 404
b) Browser URL: http://test-domain.com/xxxx.xxx
returns '); ?>
which is the tail end of the script !
--
Edit bug report at https://bugs.php.net/bug.php?id=62086&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62086&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62086&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62086&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62086&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62086&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62086&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62086&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62086&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62086&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62086&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62086&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62086&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62086&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62086&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62086&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62086&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62086&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62086&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62086&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62086&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62086&r=mysqlcfg