It appears to work “sort of”, as it requires an “ErrorDocument” to be declared in “.htaccess” file to address 404 since “FallbackResource” is still being ignored by default for PHP files.
Ex.
https://mydomain.com/does-not-exist.php
Will show a standard 404 error, even though…
https://mydomain.com/does-not-exist.html
or
https://mydomain.com/does-not-exist
Will get handled by “FallbackResource” properly.
However, if I DO add an “ErrorDocument 404” directive, and go to the “does-not-exist.php” it will get processed by the “ErrorDocument” directive, which is – from my perspective more of a “hack” then a direct solution.
Despite my “opinion” on the matter, it is definitely better then the current situation. I’m just a bit stubborn to be complete honest
For my test I added the:
ProxyErrorOverride On
Right after:
ProxyPass /.well-known !
Just before:
RemoveHandler .php
In both the port “80” and “443” VirtualHost for the test domain.
I have been watching this with side interest but now a little more concerned.
I know and realise this has been about Apache but any solution requiring .htaccess is no solution for Nginx. but I am not yet convinced it actually IS a problem
TBF you don’t need any coding skills to reproduce this, in short the thread is about how to handle php files not found on the server. My 2 cents is I notice the bots don’t come back quite so much when they are fed a
AH01071: Got error 'Primary script unknown'
response, but as @tpnsolutions says there are various responses that apache can send dependant on how it’s set up
Or loss .. i have no idea if nginx passes non existent files to php-fpm for it to process, when in fact these files should never be passed to fpm. Perhaps nginx passes the files to php-fpm but just handles the response for php-fpm differently so it could be a loss for nginx.