My host allows me a custom HTML 404 page. I want to display a nice error message, along with the name of the page that generated the message. If the page has html extension, I can't use php. Is any workaround to make Apache to process a php code <?php ... ?> inside a page that has html extension?
The easiest solution is to not use your hosts control panel but do it yourself - create a .php error page and specify that as the error document via .htaccess: ErrorDocument 404 /404.php Code (markup): That will send all 404 requests to a script called "404.php" in the root of your domain.
If I have only one .htaccess file, in the root of the domain it should handle only the 404 for the root, like: xxx.com/badlink.php or all the 404s, even for: xxx.com/test/badlink.php?