Blocking specific extensions in htaccess

2020-08-01 05:39发布

问题:

I have a directory with files like:

/files/archive.01.json
/files/archive.02.json
/files/archive.03.json
/files/hello.php

I need the .htaccess to block access to all .json files in that directory. Any ideas?

回答1:

Try this:

<Files "*.json">
    Order Deny,Allow
    Deny from all
</Files>