0

I have a directory in my webserver for which I would like to serve up only pdf files. I found I can restrict access using the .htaccess, and using something like

<FilesMatch "\.(text,doc)">
  Order allow,deny
  Deny from all
  Satisfy All
</FilesMatch>

to serve up everything except a regular expression. Is it possible to instead restrict access to only files which meet some regular expression?

1 Answer 1

1

I'm not personally familiar with the approach you're taking, but to give you a general direction to look...

You should be able to set a general deny all for all files in the directory. Then, you can use the block in your original post to give specific allow access to the filetypes matching the regex you want, using filesmatch. Something along those lines should work. Someone else may be able to provide specific code for it, I just am not familiar enough with apache's syntax to figure it out off the top of my head.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .