Reputation: 1305
How I add multiple files in htaccess files tag? The code bellow works for one file.
<Files wp-login.php>
Order Deny,Allow
Allow from 191.211.9.1
Deny from all
</Files>
I end up using this:
<filesMatch "^(wp-login|wp-file)\.php$">
Order Deny,Allow
Allow from 190.190.0.1
Deny from all
</filesMatch>
Upvotes: 12
Views: 13479
Reputation: 9097
Here are some options to do so:
"Forbidden"
to the user:In this case, "user"/"hacker"/"adversary"/"pentester" would figure out those files exist on your server but s/he doesn't have access to them!
<FilesMatch "(?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?)">
Require all denied
</FilesMatch>
"404"
to the user:In this case, "user"/"hacker"/"adversary"/"pentester", theoretically, would assume those files don't even exist on your server!
<FilesMatch "(?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?)">
Redirect 404
</FilesMatch>
Upvotes: 2
Reputation: 3539
Try something like this(not tested but should work):
<Files ~ "^(admin|wp-login|one-more-file)\.php$">
or this:
<FilesMatch "^(admin|wp-login|one-more-file)\.php$">
Upvotes: 14