# =====================================================================
# Shared-hosting deployment — public_html/sms-erp/.htaccess
# Serves the app at https://itartificer.com/sms-erp (no "/public" needed).
# =====================================================================
<IfModule mod_rewrite.c>
    Options -MultiViews -Indexes
    RewriteEngine On

    # 1) Block direct web access to source / sensitive files.
    RewriteRule ^(\.env.*|composer\.(json|lock)|package(-lock)?\.json|artisan|.*\.md|.*\.sql)$ - [F,L]
    RewriteRule ^(app|bootstrap|config|database|resources|routes|storage|tests|vendor)(/.*)?$ - [F,L]

    # 2) Serve real files that live in the public/ folder (css, js, images, storage…).
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteCond %{DOCUMENT_ROOT}/public/$1 -f [OR]
    RewriteCond %{DOCUMENT_ROOT}/sms-erp/public/$1 -f
    RewriteRule ^(.+)$ public/$1 [L]

    # 3) Everything else → the Laravel front controller at the project root.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]
</IfModule>
