Redirect 404 errors without rewriting the URL

Knocks X asked:

Is it possible to have an erroneous URL remain in the address bar while redirecting the user to a URL within my domain? I want to be the actual site being served in all 404 circumstances but I don’t want the referring URL to be rewritten (other than the domain portion, which is being done on the registrar level).

This is my current .htaccess

RewriteEngine On

RedirectMatch permanent ^/$

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* [L,R]

My answer:

You want to send 404 errors up to your application? Easy enough. You need to specify an existing file, though. For example:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /forum/index.php [L]

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.