I'm trying to figure out why Apache doesn't pass the ErrorDocument path as a PHP $_SERVER variable.
Take the following Apache VHOST configuration. All requests are sent to "index.php" unless the request is within "/js", "/media", or "/skin" (much like Magento).
# Error documents
ErrorDocument 401 /core/error/notauthorized/
ErrorDocument 403 /core/error/notfound/
ErrorDocument 404 /core/error/notfound/
ErrorDocument 500 /core/error/internalservererror/
ErrorDocument 503 /core/error/serviceunavailable/
# index.php rewrite bootstrap
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/(js|media|skin)/
RewriteRule .* /var/www/mydomain.com/public/www/index.php [L]
Lets say that a user attempts to access a file within the "/skin" directory that doesn't exist: "/skin/i/dont/exist.jpg".
My expectation is that since Apache sees that this file physically doesn't exist, it attempts a request (relevant to the root) to "/var/www/mydomain.com/public/www/core/error/notfound/". It does do this and the request is handled properly through the bootstrap. However, all the $_SERVER variables indicate the originally requested path "/skin/i/dont/exist.jpg" and not the ErrorDocument path.
Apache does set "REDIRECT_STATUS" to 404, but it seems this would be the only way I know there was a problem. I want my bootstrap index.php to know that Apache is actually trying to request "/core/error/notfound/" so its routed correctly.
Am I missing an Apache setting? Are my expectations of how this should function incorrect? I'm using PHP 7.0.8 and Apache 2.4.18 on Ubuntu.