this is my first question here, I hope to find a solution. I have a problem with page 404 when the missing page is in a sub "virtual" directory, is used to pass a value to php, in DocumentRoot not exist a directory "de" (for example) for this reason I cannot create a 404 page for each directory. If the url is www.example.com/wrongpage.html works fine shows the custom 404 page thanks to ErrorDocument 404 /404page.php in the htaccess.
If the url is www.example.comm/**de**/wrongpage.html it shows "File not found." and it doesn't load my 404 custom page.
I tried adding "ProxyErrorOverride On" to apache.conf no result even in virtualhost no result. The server has no particular configuration, everything is by default. Since I am using php-fpm before I used php so many configurations are inherited.
Here are the htacces and the virtualhost
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* . [F,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+).html $2.php?ln=$1 [L]
</IfModule>
ErrorDocument 404 /404page.php
It doesn't work either by putting an absolute URL
ErrorDocument 404 https://www.example.com/404page.php
And part of virtualhost
DocumentRoot /www/example.com/
AccessFileName .htaccess
<Directory /www/example.com/>
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
Thank you all