无法阻止WordPress自述文件

时间:2017-05-31 作者:Prasanna Kumar

请检查此项。htaccess规则。我想阻止所有自述文件和此类文件,但我无法这样做。

Redirect 404 /install.php
Redirect 404 readme.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule (?:readme|license|changelog|-config|-sample)\\.(?:php|md|txt|html?) - [R=404,NC,L]
RewriteRule \\.(?:psd|log|cmd|exe|bat|c?sh)$ - [NC,F]


</IfModule>
Options All -Indexes

<files wp-config.php>
order allow,deny
deny from all
</files>

<files ~ "^.*\\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</files>


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

1 个回复
SO网友:djhru

您并不真正需要这些:

Redirect 404 /install.php
Redirect 404 readme.html
阻止readme.html 您可以这样做:

<files readme.html>
         order allow,deny
         deny from all
</files>
对于其他类型的文件,只需在代码中更改文件名即可。

结束