Exclude a single file from .htaccess password protection

Exclude a single file from .htaccess password protection

Sometimes it may be necessary to allow access to a single file in a password protected directory (e.g. WordPress).

This is easily possible with some additional code within the corresponding .htaccess file.

For this purpose, the following code can be used as an example:

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

The above code will output the “filei.php” file without a password, even if there is .htaccess password protection.

Leave a Reply

Your email address will not be published. Required fields are marked *