Warm tip: This article is reproduced from serverfault.com, please click

.htacess specifying specific files on one line

发布于 2020-11-28 09:38:24

I have the following in part of my .htaccess file:

# the following prevents display of the filetohide file
<files handler.php>
order allow,deny
deny from all
</files>

<files submit.php>
order allow,deny
deny from all
</files>

Can multiple file specifiers not be done within a single set of tags, i.e:

<files submit.php|handler.php|otherfile.txt>
order allow,deny
deny from all
</files>

regards Russell

Questioner
Russell
Viewed
0
RavinderSingh13 2020-11-28 19:33:52

Could you please try following, if this helps you for multiple file names with different formats(I am yet to test this but written this based on regex).

<files ~ "^((submit|handler)\.php)$|^(otherfile\.txt)$">
order allow,deny
deny from all
</files>