# RentNest — use this file ONLY if your host will not let you point the domain at the "public" folder.
# Copy it to the app's top folder (next to artisan) and rename it to ".htaccess".
# It sends every request into public/ and blocks direct access to everything else
# (.env, storage, vendor, database files) so they can never be downloaded.

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Keep the Authorization header (needed for sign-in tokens on some Apache setups)
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Already inside public/: let public/.htaccess handle it
    RewriteRule ^public/ - [L]

    # Everything else is served from public/
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Belt and braces: never serve hidden files such as .env, even if rewriting is off
<FilesMatch "^\.">
    Require all denied
</FilesMatch>
<FilesMatch "\.(env|sqlite|sql|log|md|lock|json|xml|yml|yaml)$">
    Require all denied
</FilesMatch>
Options -Indexes
