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>
You can have more than one . htaccess file on your hosting account, but each directory or folder can only have one. For example, you can have separate . htaccess files in your root folder and another in a sub-folder.
FilesMatch allows you to match files using a regular expression. On your above FilesMatch you have 4 sets of regular expression where the 1 set have an secondary optional set. Basically what it is doing is forbidden access (error 403) to any of the files found that are described on your sets of regex.
htaccess file can be used to load customized error pages (such as 404 pages), create URL redirects, implement password-protected authentication for specific directories on your server, and more.
. htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
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$">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With