Reputation: 3239
I keep getting a 404 after a 20 second request when I want to simply 403 a path request via htaccess.
In my htaccess I place this at the bottom:
<Files /autodiscover/autodiscover.xml>
Order Allow,Deny
Deny from all
</Files>
How can I do this? What am I doing wrong?
Upvotes: 1
Views: 4330
Reputation: 10547
If you simply want to ignore all requests to autodiscover.xml for whatever reason, say for example they fill up your log files with stupid requests or keep hitting your custom CMS 404 page. You can simply respond with a very small 204 No Content
header like in this htaccess
example:
Redirect 204 /autodiscover/autodiscover.xml
Why? A 204 response is cacheable by default. A 4xx header may or may not be cached.
Upvotes: 4
Reputation: 24458
Files directive only work with files on a per directory basis. That's why you're getting a 404.
The directive limits the scope of the enclosed directives by filename.
http://httpd.apache.org/docs/current/mod/core.html#files
Put this inside an .htaccess file inside the autodiscover
directory.
<Files "autodiscover.xml">
Order Allow,Deny
Deny from all
</Files>
Or you can use a rewriterule in your htaccess file in the root
directory.
RewriteRule ^/?autodiscover/autodiscover\.xml$ - [F,L]
Upvotes: 1