# WHMCS Affiliate Portal - root .htaccess
# Use this when the subdomain document root is the extracted folder (typical cPanel/DirectAdmin/Plesk).
# Recommended: point the document root at /public instead (see docs/INSTALL.md), then this file is not used.

Options -Indexes -MultiViews
DirectorySlash Off

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Never serve private folders, hidden files, SQL/log/lock/config files
    RewriteRule ^(app|config|database|storage|cron|bin|docs|install/.+|vendor)(/|$) - [F,L,NC]
    RewriteRule (^|/)\.(?!well-known) - [F,L]
    RewriteRule \.(sql|log|lock|md|tmp|bak|inc|sh|ini|dist|example)$ - [F,L,NC]

    # Public static files live in /public
    RewriteRule ^(assets|help)/(.+)$ public/$1/$2 [L]

    # Everything else goes through the front controller
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "DENY"
    Header always set Referrer-Policy "no-referrer"
</IfModule>
