简体   繁体   中英

Block access to php.ini and phpinfo.php in root

I read another question on how to do this, and the most highlighted solution was the following:

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

I can't really fiddle with this without knowing for sure, since I don't have any testing environment or anything.

My question is, can I add multiple files to the same rule for denying access? What would the formatting be to add additional files to the same deny rule above?

Help is appreciated. Thank you.

You can use regular expressions per the manual entry for <Files> , or <FilesMatch> :

<FilesMatch "/(phpinfo\.php|php\.ini)">
    order allow,deny
    deny from all
</FilesMatch>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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