# Disable LiteSpeed Cache for this directory
<IfModule LiteSpeed>
    CacheLookup off
    RewriteEngine On
    RewriteRule .* - [E=Cache-Control:no-cache]
</IfModule>

# Disable caching headers
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

DirectoryIndex index.html

# Disable directory listing
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # If file exists, serve it
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .* - [L]
    
    # If directory exists, serve it
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule .* - [L]
    
    # Everything else goes to index.html
    RewriteRule .* index.html [L]
</IfModule>

# If mod_rewrite is not available, at least try to serve files normally
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.html
</IfModule>

# Enable GZIP compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/javascript application/json
</IfModule>

# Set caching headers
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

# Security headers
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
</IfModule>
