.htaccess htaccess文件标记中的多个文件

lvjbypge  于 2023-08-06  发布在  其他
关注(0)|答案(2)|浏览(93)

如何在htaccess文件标签中添加多个文件?下面的代码适用于一个文件。

<Files wp-login.php>
Order Deny,Allow
Allow from 191.211.9.1
Deny from all
</Files>

字符串
我最终使用了这个:

<filesMatch "^(wp-login|wp-file)\.php$">
Order Deny,Allow
Allow from 190.190.0.1
Deny from all
</filesMatch>

zbwhf8kr

zbwhf8kr1#

尝试类似这样的操作(* 未测试但应该有效 *):

<Files ~ "^(admin|wp-login|one-more-file)\.php$">

字符串
或者这个:

<FilesMatch "^(admin|wp-login|one-more-file)\.php$">

bihw5rsg

bihw5rsg2#

2023解决方案

以下是一些选项:

返回"Forbidden"给用户:

在这种情况下,“用户”/“黑客”/“对手”/“pentester”会发现这些文件存在于您的服务器上,但他/她没有访问它们的权限!

<FilesMatch "(?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?)">
      Require all denied
</FilesMatch>

字符串

返回"404"给用户:

在这种情况下,“用户”/“黑客”/“对手”/“pentester”,理论上,会假设这些文件甚至不存在于您的服务器上!

<FilesMatch "(?:readme|license|changelog|-config|-sample)\.(?:php|md|txt|html?)">
      Redirect 404
</FilesMatch>

相关问题