简体   繁体   English

禁止直接访问.htaccess中的.php文件

[英]Prevent direct access to .php files in .htaccess

I want to prevent direct access to php files to prevent bot attack 我想防止直接访问php文件以防止Bot攻击

It is completely shut down with the following htaccess code. 使用以下htaccess代码将其完全关闭。 it didn't work for me 它对我不起作用

RewriteEngine on 
RewriteCond %{THE_REQUEST} \.php[\ /?].*HTTP/ 
(.*)\.php$ /index.html [L] 

If you want that just the server has access to your php files you can use this: 如果您只希望服务器可以访问您的php文件,则可以使用以下命令:

<Filesmatch "\.(php)$">
    Require local
</FilesMatch>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM