# Allow access to PDF, DOC, and DOCX files explicitly
<FilesMatch "\.(pdf|doc|docx)$">
    # For Apache 2.4+
    <IfModule mod_authz_core.c>
        Require all granted
    </IfModule>
    # For Apache 2.2
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Allow from all
    </IfModule>

    # Allow cross-origin access for Mozilla PDF.js viewer
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "https://mozilla.github.io"
    </IfModule>
</FilesMatch>

# Block access to PHP, JS, HTML, HTM, and TXT files
<FilesMatch "\.(php|js|html|htm|txt)$">
    # For Apache 2.4+
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    # For Apache 2.2
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</FilesMatch>
