# wifidog/.htaccess
# Enables PATH_INFO so /wifidog/index.php/ping/ works correctly.
# Ruijie MCFi cloud appends /ping/ /auth/ /portal/ to the Post URL.

Options -Indexes
ServerSignature Off

# Enable PATH_INFO — required for MCFi path routing
AcceptPathInfo On

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Pass PATH_INFO through to index.php
    # /wifidog/index.php/ping/  → index.php with PATH_INFO=/ping/
    # /wifidog/index.php/auth/  → index.php with PATH_INFO=/auth/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^index\.php/(.*)$ index.php [PT,L,QSA]

    # Do NOT force HTTPS here — keep plain HTTP option
    # (Ruijie MCFi calls via HTTPS already, but don't block HTTP)
</IfModule>

# No caching for auth responses
<FilesMatch "index\.php$">
    <IfModule mod_headers.c>
        Header set Cache-Control "no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
    </IfModule>
</FilesMatch>
