Thanks, Omar. There are two issues here.
First Issue:
If some product is deleted from database, or a category, or a stattic page, if nothing broken in script or templates, there will be a 404 message page, not a blank page.
You are right. This happens with my template, not with the standard ones. I did not have a utilities.tpl file. I have fixed this now. Thanks for your help.
My apologies for the rant. The MAJOR BUG was in my template!
Second Issue:
Below is a revised .htaccess file with two changes:
1) |^/articles/ has been added to this list of exceptions, so that a request for any document in that directory will not get sent to index.php
2) A custom error handler has been set up in the cgi-bin.
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^[^\.]*[^/]$
RewriteRule (.+) $1/ [R,L]
RewriteCond %{REQUEST_URI} !^/index\.php|^/admin|^/click\.php|^/templates/|^/install\.php|^/robots\.txt$|^/favicon\.ico|^/sitemap\.xml|^/articles/
RewriteRule (.+) index.php?req=$1&%{QUERY_STRING}
ErrorDocument 404 /cgi-bin/404.cgi
The result is satisfactory. My custom error handler gets called for all requests in /articles/ so I can implement a dynamic content site in that directory. The standard StoreStacker error handler gets called everywhere else.
Again, thanks for the utilities.tpl tip.
Cheers,
Peter