.htaccess, um den Zugriff auf nur ausgewählte Dateien zu beschränken

699
Bryan Ward

Ich habe in meinem Webserver ein Verzeichnis, für das ich nur PDF-Dateien bereitstellen möchte. Ich habe festgestellt, dass ich den Zugriff mit .htaccess einschränken kann und so etwas wie

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

alles außer einem regulären Ausdruck zu dienen. Kann der Zugriff stattdessen nur auf Dateien eingeschränkt werden, die einem regulären Ausdruck entsprechen?

0

1 Antwort auf die Frage

1
nhinkle

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.