Menu Close

How to Prevent Access to Your php.ini file or any other risky files by htaccess file

If you run the risk of someone accessing your php.ini  file directly through their browsers, you can limit access to them using htaccess file.

Put following lines in your .htaccess file:

<Files php.ini>
Order allow,deny
Deny from all
</Files>

If you want to prevent the risk access to your other files such as your htacess, htpasswd, ini, phps, fla, psd, log, sh files, you can also put following lines into your htaccess file:

<filesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
 Order Allow,Deny
 Deny from all
</filesMatch>

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

See also  How to Prevent Hotlink in WordPress Websites ?
  • You must be logged in to reply to this topic.