📜  .htaccess 防止访问您的 PHP 包含文件 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:49.540000             🧑  作者: Mango

代码示例1
## Enable Mod Rewrite, this is only required once in each .htaccess file
RewriteEngine On
RewriteBase /
## Test for access to includes directory
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /includes/ .*$ [NC]
## Test that file requested has php extension
RewriteCond %{REQUEST_FILENAME} ^.+\.php$
## Forbid Access
RewriteRule .* - [F,NS,L]