# =============================================================================
# cPanel SUBFOLDER deployment (fallback method)
# Use this ONLY if the app is served from a subfolder of the main domain, e.g.
#   https://milieucare.com.my/luckydraw/   (docroot = public_html/luckydraw/)
# and you upload the whole `backend/` folder there. It rewrites all traffic into
# `public/` (which holds the enhanced SPA + API .htaccess).
#
# PLACE this file at:   public_html/luckydraw/.htaccess   (i.e. backend/.htaccess)
#
# PREFERRED method (avoids rewrites entirely): in cPanel create a subdomain or
# addon domain whose Document Root points straight at  public_html/luckydraw/public
# (or wherever you uploaded backend/public). Then you do NOT need this file.
# =============================================================================

<IfModule mod_rewrite.c>
    RewriteEngine On

    # If assets/routes 404 in a subfolder, uncomment and set the subfolder path:
    # RewriteBase /luckydraw/

    # Block direct web access to sensitive Laravel app files/directories.
    RedirectMatch 403 (?i)/(app|bootstrap|config|database|resources|routes|storage|tests|vendor)(/|$)
    RedirectMatch 403 (?i)/\.(env|git.*|htaccess)

    # Route every other request into Laravel's public/ folder.
    RewriteCond %{REQUEST_URI} !/public/ [NC]
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
