First, an honest hat tip to those who speak the language of Linux, Apache, Perl, Regex, etc. I thought "the law" was a Gordian knot. #%$! This stuff, with its exacting syntax requirements, multiple dependencies, endless variations on the "means to an end" (Do it this way. No, do it THIS way!) reminds me of the U.S. Bankruptcy Code, where every section of the Code is connected to and conditioned by 7 other sections. Argh! IF I wasn't using this effort to learn a bit of coding, to atone for my $hitty attitude whilst studying high school algebra, quadratic equations, etc, I would just . . walk away. :-/
Okay, to prove I'm not being a lazy a$$, just a dumba$$, I will admit that I've just put about 5+ hours into this simple (ha-ha) ~experiment, after putting countless more hours into reading, reading, reading Apache.org, tutorials, etc. (I'm about 100+ hours in by now. I know, more to go.)
Motivation: I have all manner of bots probing for "/this/feed" or "that/andthat/andthat/feed/". Sometimes they hit. Other times they miss. I'd like to kick all /feed requests to the curb, without using a plugin. Just kill them before they get to WP.
I played with inserting this (code) below in a <Directory /home/*/public_html/> wrapper but, no matter what I tried, I kept getting an error message suggesting that there was a clash between the <Directory . . .> <If . . . >
Require all denied AND a next-in-sequence <FilesMatch> directive that nicely has been blocking access (Require all denied) to certain files on its own. It was as if I didn't "close" the prior rule/arguments but I did, as far as I could could see. (Checked for ", }, ), /> you name it.)
When I removed the <Directory> context Apache didn't choke on the <If> directive (below) as a stand alone directive . . BUT. . I had a nagging feeling that said "acceptance" (no error message) was because my <If> directive was a fekless (<- no c's allowed) directive, as in "
a directive that won't do what I thought . . and is probably doing something I'm not expecting".
SO, I just browsed to example.com/feed and example.com/category/feed/ and . . . dangit . . a ~feeds loaded.
If you will, what am I missing . . in order to effectively deny, by rule, all access to any ~/feed | /feed/ via a http_request_uri ?
Am I a complete idiot in thinking that there IS such a "directory"? That it's actually a "file"? ("Maybe that's it", he sheepishly thought to himself, after publicly confirming his utter lack of understanding.) Webwork quickly adds "feed" to <FilesMatch> directive to test. No effect. ~feed loads. Argh.
<If "%{REQUEST_URI} == '/feed/?'">
Require all denied
</If>
Note: I'm running Apache 2.4
P.S. When using an "access provider" such as "Require all denied" - is not the access provider limited in scope/effect "to the condition" to which it is related. As in <If> Argument -> Consequence </If> -> NO effect on any other request(s)? Limited to that little chunk of requests, i.e., requesting /feed/?
P.S. To Lucy24: I've given up my <Location> ways. I get the (potential) problems.
Thanks.