On my small local development machine, I downloaded PDT + Zend Server, which incorporated Apache 2.2.16 and PHP 5.3.5, running on Home windows 7. On my small local site, I incorporated b .htaccess which includes ErrorDocuments for 404, 403, and 500. During my PHP, I personally use header("Http/1. 404 Not Found") once the user demands a document that does not exist. On my small local server, everything is effective. My custom ErrorDocument seems and I am happy.

I upload the everything to my shared host running Apache 2.2.38 and PHP 5.3.8 on the Linux server, and all of a sudden the ErrorDocuments only work when they don't originate from PHP.

Can there be some establishing PHP.ini or httpd.conf or .htaccess that enables Apace to determine the mistake codes from PHP, making my dev server work properly, although not my shared host?

In researching this, all I ever saw was "Apache does not begin to see the status code once it passes off and away to PHP." In this situation, how come my dev server work right?


For clearness, here's the .htaccess:

# Use PHP 5.3
Action application/x-hg-php53 /cgi-sys/php53
AddHandler application/x-hg-php53 .php 

#Deny Include Files
<Files *.inc>
order deny,allow
deny from all

#Provide custom error documents
ErrorDocument 404 /Errors/Http404.php
ErrorDocument 403 /Errors/Http403.php
ErrorDocument 500 /Errors/Http500.php

The .htaccess works if the consumer navigates to myhost.com/jdkslfjdls the consumer receives this content of Errors/Http404.php.

However, when the user navigates to myhost.com/images/GetImage.php?Id=5 (when there's no image #5) the consumer receives no content.

When they navigate to (Internal Ip)/images/GetImage.php?Id=5, the consumer receives this content of Errors/Http404.php.

An identical problem happens when the user attempts to access GetImage.php?Id=6 (when there's a picture #6 however they do not have permission). Around the shared server, they obtain a blank page or even the browser's 403 error. On my small dev server, they get my actual custom 403 error page.

Again, 403 error document creates the shared server basically attempt to access b .corporation file.

Are you certain that the .htaccess file can be used around the server? Sometimes the webhost doesn't permit the global apache configurations to become overwritten through the local .htaccess files.

Should you however get access to your virtualhost configuration than you might want to consider the following directive

AllowOverride All

If rather you discover

AllowOverride None

attempt to change as above.

Check for those who have

AllowOverride ALL

inside your apache.conf underneath the Directory directive within the VirtualHost corresponding aimed at your website

Anyway, that might be one possible cause, another might be to check on whether you've enabled mod_rewrite

On ubuntu or debian based systems, you'd simply link or copy the mod_rewrite.load from /etc/apache2/mods-available/mod_rewrite.load to /etc/apache2/mods-enabled/mod_rewrite.load

Rewrite must have absolutely nothing to do though, but I have seen cases when your .htaccess directives may need mod_rewrite

Check for individuals things in apache conf files. If nothing happens get in touch @ phpcip@gmail.com

Hope it really works.