I setup a .htaccess file to require authentication for a directory. I would like to exempt certain files (csv) to avoid some issues with downloading.
I can limit the authentication to the files by doing:
<files ~ "\.csv$">
require valid-user
</files>
But how can I negate(!) them so ALL files except csv files require authentication?
This should work:
I’ve tested this on my local server (Apache 2.2.14) and it works fine. All files except
.csvfiles require authentication before downloading.Edit
Sorry about all the edits. These sort of regular expressions are always tricky 🙂