Sorry you couldn't get it working, Ernest.
But honestly, it kind of sounds like something specific to your setup, rather than something with Contao. Because if you leave the rule as you have it in #2, if anything I'd think ONLY the .html pages should work, not the other way around.
How are you redirecting FROM Contao's 404 page TO the actual error page? And is the actual error page a physical .HTML file? If so, are the following rules DIRECTLY ABOVE the rule you show in #2?
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Only comments can go in between
RewriteRule .*\.html$ index.php [L]
That's really important, because that's where it tells the server not to rewrite anything that's a physical file. Without these rules even URLs to files that exist will get filtered through Contao instead.
This might be what is happening:
1. You enter a URL that doesn't exist with a '.html' extension.
2. Since your specific RewriteRule instructs Contao to ONLY handle .html files, it kicks in only for this use case. Others are handled directly by your ErrorDocument rule, so they're not affected.
3. Contao can't find that page, so it sends you to the "404" page.
4. That "404" page redirects to a physical page called "page-not-found.html".
5. But if those above 2 RewriteCond's don't exist, Contao intercepts that URL too.
6. Contao sees the alias "page-not-found".
7. It looks but can't find a page with that alias in the system so it routes you to the "404" page.
8. But then that just redirects back to "page-not-found" and the process starts over again, creating a loop.
Maybe Contao is smart enough to spot the loop and at some point simply says "screw it", and sends you to that blank page.
Worth asking -- for your .htaccess file, did you start with the one that ships with Contao (and maybe make any changes you need to that)?
Also, did you start with the one that ships with your specific version? I noticed a big difference in the rules between 2.8 and 2.9, so if you did an upgrade, or you grabbed one from an older install, you may want to take a look at that.
The reason I suggested my setup in the previous post is, if you do that then Contao will handle ALL 404 requests, and you can manage your 404 page content directly in the backend -- no need for a separate physical 404 file.
Bookmarks