<IfModule mod_rewrite.c>
    RewriteEngine On

    # 1. Route /iclock/* requests directly to public/index.php
    #    This handles ZKTeco ADMS device push requests regardless of
    #    whether the device is configured for /attendance_new/iclock/...
    RewriteRule ^iclock(/.*)?$ public/index.php [L,QSA]

    # 2. Standard subfolder routing — forward everything else to /public
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/$1 [L,QSA]
</IfModule>
