1 Answer
1

Create an .htaccess file in the directory you wish to block, or your root HTML directory if you want this to affect your entire website. Place this code inside:

# Block includes if they have a .inc.php extension. Change
# that to match whatever extension you use for your includes.
<Files *.inc.php>
Order Deny,Allow
Deny from All
</Files>
# Block access to .txt files
<Files *.txt>
Order Deny,Allow
Deny from All
</Files>
# Create a custom page for all 403 errors
ErrorDocument 403 /misc/403.php