Tony
Tony

Reputation: 383

How to change .htaccess deny action to "abort"

I have implemented various deny rules in my Apache .htaccess file. The default deny action is a 403 (forbidden) response from my web server. Is there a way to change Apache's deny action to "abort" (no response) analogous to IIS 8+ denyAction="AbortRequest"? Ideally, I would like to be able to specify this "abort" action in the .htaccess file. Thank you.

Upvotes: 2

Views: 65

Answers (1)

MrWhite
MrWhite

Reputation: 45829

You can't literally "abort" the request (as in "drop" the connection and send no response) in .htaccess.

The default deny action is a 403

That's what the (Apache 2.2) deny directive does. You can override this HTTP response status using a custom ErrorDocument 403 (requires another server-side script) or use a mod_rewrite (or mod_alias) directive to send a different response (a different method entirely), but in all cases you are still sending an HTTP response.

Upvotes: 2

Related Questions