But your issue is not really htaccess related.
In php if you send 404 header the browser wont be redirected to the 404 page automaticaly, but you have to serve error page content yourself in PHP, as it is done by most frameworks with internal routing system.
Hi Benoit, So you are saying that only sending a 404 header does not force Apache to server the content at the ErrorDocument URL. If I serve the content from PHP, after setting the 404 header, I do get the 404 page displayed in the browser, but the address bar still shows the invalid URL, instead of /404/. After giving some more thought, I guess that's not actually bad at all.
Hi, You're right, it does not seems bad if browser is not forwarded to real 404 page url. Apache does not redirect too using ErrorDocument declaration. IMHO it is better this way : search engines crawler will forget the url responding with 404 http response code, and humans will see a nice 404 page instead of apache's default one or worse, page with errors on it.
It's normal your server do not push any 404 error, you're using a catchall regexp ((.*)) as the only rewrite rule.
Yes declare 404 document after the Rewrite rules