# Gojo.watch backend — document-root .htaccess.
# Use this file ONLY when the document root is the backend folder itself
# (the subdomain setup: a subdomain pointed at this folder, outside public_html).
# When the document root is backend/public/ instead, this file is ignored
# and public/.htaccess does the routing.
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Never serve sensitive paths directly (source, data, config, docs).
    RewriteRule ^(src|data|cache|tools|migrations|config\.php|README\.md|DEPLOY\.md|\.git) - [F,L]

    # Real files live under public/ — serve them from there.
    RewriteCond %{DOCUMENT_ROOT}/public/$1 -f
    RewriteRule ^(.*)$ public/$1 [L]

    # Directories under public/ (e.g. /admin/) — serve their index.php.
    RewriteCond %{DOCUMENT_ROOT}/public/$1 -d
    RewriteRule ^(.*)$ public/$1/index.php [L]

    # Everything else goes to the front controller.
    RewriteRule ^(.*)$ public/index.php [QSA,L]
</IfModule>
