Redirect 404 to another domain with apache?

apache, http-status-code-404, mod-rewrite

Solution

You should first decide what status code you want to send. Sending both a 404 status code and a redirect is not possible.

But seth did already mention the right method, the `ErrorDocument` directive:

# local path
ErrorDocument 404 /local/path/to/error/document
# external URI
ErrorDocument 404 http://uri.example/to/error/document

If you use a local path, the 404 status code is sent. If you use an absolute URI, a 302 status code (temporary redirect) is sent.

And if you want to send a 301 redirect:

Redirect 301 / http://new.example.com/

Problem

Hey guys, have a question regarding apache. I have a site that's been re-engineered, but I want to capture all the 'old' links that people may have bookmarked or come from search engines to the old site which is under a new domain name. How do I get apache to redirect only 404 not found to the old site? TIA, J

Original source