Is it possible to render another page instead of one currently being processed?
For instance, my plugin detects 404 error, sets corresponding HTTP headers, and then outputs a normal page from website – but under those HTTP 404 headers, so the browser and search engines will receive custom, good-looking 404 page.
Redirecting by
<? header("Location: ...'); ?>
is not an option. I need stop rendering current page and render another, but display it under this, non-existing url.
How this can be done?
Sounds like you need a system event plugin, please see:
http://docs.joomla.org/Plugin/Events/System
in particular, the onAfterDispatch method:
http://docs.joomla.org/Plugin/Events/System#onAfterDispatch
The onAfterDispatch method is called after routing, and after Joomla has determined whether the url is valid, so it should be the time to get involved and redirect to another page.