# Forward all requests to the `public` folder so the site works when
# the whole project is inside public_html/absensicai
<IfModule mod_rewrite.c>
    RewriteEngine On

    # If root requested, serve public/ (index.php inside public will handle it)
    RewriteRule ^$ public/ [L]

    # Otherwise pass through to public/<path>
    RewriteRule (.*) public/$1 [L]
</IfModule>

# Ensure index.php is the default
DirectoryIndex index.php
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1 

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php
</IfModule>

# block access
RedirectMatch 403 .env
RedirectMatch 403 .gitattributes
RedirectMatch 403 .gitignore
RedirectMatch 403 .htaccess
RedirectMatch 403 .bash.exe.stackdump
RedirectMatch 403 .builds
RedirectMatch 403 .composer.json
RedirectMatch 403 .composer.lock
RedirectMatch 403 .LICENSE
RedirectMatch 403 .phpunit.xml.dist
RedirectMatch 403 .preload.php
RedirectMatch 403 .README.md
RedirectMatch 403 .spark