"File not found." instead of custom 404 file with php-fpm enabled
-
Well sure enough - I created a cpanel version 90 machine and checked the page there and you could sort the PHP-FPM column, so I've created case CPANEL-36096 with our developers to look into that. Thanks for your great feedback! 0 -
Thanks for the link, I'll check it out. This whole thing has gone sideways from where I thought it should originally, but I'm glad I'm getting my head around it now and feel like it's a better direction. CPANEL-3096 sounds good. Hope you can get them to put that back in (or fix what they broke ;) ). 0 -
Did CPANEL-36096 get dropped? I just noticed that in 120.0.2 we *still* can't sort by PHP-FPM, like we used to be able to do.
???
0 -
Unfortunately yes - since this thread was the only mention of this issue the developers have opted to not fix it.
0 -
I know - I just get to be the bearer of bad news sometimes!
0 -
*eye roll*
Thanks Rex!
0 -
Since this is the year to respond to 6 y/o posts... lol I realized I never posted my very simple solution to the problem of PHP-FPM ignoring .htaccess ErrroDocument statemetns when the problem is a missing .php file.
Typically there would be something link this in .htaccess:
#error pages
ErrorDocument 404 /404.php
ErrorDocument 403 /403.phpThis is ignored when PHP-FPM in enabled. (The workarounds discuss at the top part of this thread cause other issues, as documented.)
Placing this in .htaccess serves to send traffic to a bad .php file name to the 404 handler of choice, the same as for bad non-.php requests (subdirectories, .html, etc.)
#error pages if PHP-FPM is active
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.+\.php /404.php [L]I hope this helps someone! :)
1 -
Thanks for sharing that!
0 -
Thank you PeteS.
Works great
Any idea how to extend that to links without .php at the end ?
For instance www.mydomain.com/blah instead of www.mydomain.com/blah.php
ErrorDocument handles the former just fine as wellAlso, I assume the error doesn't trickle through this way to the client that is making the request ?
If I'm not mistaken the error does go through with ErrorDocument, so that search engines don't index broken links (and don't start indexing 404.php because it's got all those incoming links from broken websites)EDIT. Actually that last bit can be forced by setting the header I believe:
header("HTTP/1.1 404");0
Please sign in to leave a comment.
Comments
40 comments