What potential pitfalls should be considered when using .htaccess to protect PHP files in a directory?

One potential pitfall when using .htaccess to protect PHP files in a directory is that if the server is not properly configured, the .htaccess file may not be recognized or executed. Additionally, misconfigurations in the .htaccess file itself could lead to unintended consequences such as blocking legitimate access to the PHP files or causing server errors. It is important to thoroughly test the .htaccess rules and ensure they are functioning as intended before deploying them in a production environment.

# Example .htaccess file to protect PHP files in a directory
<FilesMatch "\.php$">
    Order allow,deny
    Deny from all
</FilesMatch>