php script does not always execute or too slowly 301 redirect



Hello,
PHP vesion 4.4.1
On our corporate web site we use a common script that is called via an include at the start of every page.
We just made a major site change and have a long list of 301 redirects. I decided to handle the 301's in the common script instead of htaccess.

Now in the logs we are getting a lot of 404 not found errors on pages that should be redirecting. Most of these are from robots, but not all. I was wondering if this was just a timeout issue. I am logging all errors and do not see any occurring.

The sequence of events is:
request for a not found page handled by htaccess and passed to a notfound.php page.
The first thing notfound.php does is include the common script. This script checks an array for a redirected uri. If it matches it sends a 301 header with the new page and exits.

What is happening that on some occasions the client is getting a 404 and we are not showing any errors occurring in PHP?




--
Mark B
.