I use mod_rewrite in my .htaccess for a site. I point my pages mostly to 2 scripts
Script 1 is my ErrorDocument 404 script
Script 2 is a typical mod_rewrite call with a RewriteRule
Script 1 does stuff and then includes Script 2.
A large number of url's on my site are "errors" but the requested url holds the information Script 1 needs.
For those that are good I send: Header("HTTP/1.1 200 OK");
The rest I leave as 404's so that (hopefully) the search engines record the error and don't recall the page.
Everything works for the user as I'd expect. The address bar stays with the requested page and the requested content is shown.
The search engines, however, keep trying to index Script 1 but have no knowledge of Script 2. Neither script should be called directly and are not used as links anywhere.
😕 How should I be hiding the name of the ErrorDocument so that Google et al continue to index the page they call, not the script I serve?