8

I can't find any info about it in the official documentation.

I try to allow access to two php files, A.php and B.php.

<Files "A.php">
    Require all granted
</Files>

<Files "B.php">
    Require all granted
</Files>

Does it work like this or is there a better solution?

1
  • seems odd to me that it's not simpler to apply the same bunch of directives to a group of files. Regular expressions are a convoluted solution when file names don't have much in common.
    – osullic
    Feb 12, 2021 at 21:45

1 Answer 1

8

Yes, it works like this. But you could also use a FilesMatch with a regular expression like:

<Directory /var/www/html/foobar>
    # deny access
    Require all denied

    # but allow for A.php, B.php
    <FilesMatch ^(A|B)\.php$>
        Require all granted
    </FilesMatch>

    # or alternative
    #<FilesMatch ^[AB]\.php$>
    #    Require all granted
    #</FilesMatch>
</Directory>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .