How to throw a 404 error from htaccess?

Posted by John Isaacks on Server Fault See other posts from Server Fault or by John Isaacks
Published on 2011-05-19T20:02:52Z Indexed on 2012/09/19 21:40 UTC
Read the original article Hit count: 165

Filed under:
|

Everything I find seems to be about created a custom 404 page.

That is not what I am trying to do.

If I want to block access to a page I can do this in htaccess:

RewriteRule pattern - [F]

However, "Forbidden" hints that the page does exists. I want the page to appear to not even exist. So I would like to give a 404 error instead of a 403. Then have it render whatever 404 page would render if the resource really wasn't there.

How can I do that?

© Server Fault or respective owner

Related posts about .htaccess

Related posts about 404