Menu Close

How to Prevent Access to Your php includes files by htaccess file ?

You can check our free domain suggestion tool hereĀ  Register .com From $14.8 ; .net $16.49; .org $16.99

If you are running php websites, and a php includes folder that is only used for the calling of your own php scripts. I know you do not want browsers to access your includes folder. You can do it by htaccess file using Mod_Write.

## 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]

Where /includes/ is your includes directory. All browsers to your includes folder are forbidden.

 

(Visited 4 times, 1 visits today)

Leave a Reply