We serve up our pages with Apache 2.2 on Windows. We'd like to disallow viewing of pages with the .txt extension. How can we do something like that?

Another option which would arguably be even better would be to have a list of filetypes that are allowed to be served statically.


Just FYI: My original issue was mostly just because my file regex was wrong.


Take a look at this:


hope this helps.

| improve this answer | |
  • Sorry, this is for apache 1.3 and 2.0. This won't work for 2.2 – Frew Schmidt Nov 16 '09 at 23:37
  • Did actually you test that Frew? This works for me on Apache 2.2.9. – Zoredache Nov 17 '09 at 1:15
  • Yeah, I tested it, it just seems to show the files just fine :-/ – Frew Schmidt Nov 17 '09 at 15:11
  • Frew: no offense, but you're doing something wrong. It works. – Bill Weiss Nov 17 '09 at 16:32
  • @KPWINC: it works perfecly even under Apache 2.2.19, thank you so much for sharing such an interesting link, and obviously +1 – Marco Demaio Aug 23 '11 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.