# .htaccess file
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /yoga/
    
    # Jika file atau direktori tidak ada, arahkan ke index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L]
    
    # Proteksi folder includes dan vendor
    RedirectMatch 403 ^/yoga/includes/?$
    RedirectMatch 403 ^/yoga/vendor/?$
    
    # Cegah akses langsung ke modules folder (harus lewat controller)
    RedirectMatch 403 ^/yoga/modules/?$
</IfModule>

# Batasi tampilan direktori
Options -Indexes

# Pengaturan PHP
<IfModule mod_php7.c>
    # Security settings
    php_flag display_errors off
    php_flag log_errors on
    php_value error_log "error_log.txt"
    
    # Session security
    php_flag session.use_only_cookies on
    php_flag session.use_strict_mode on
    php_flag session.use_trans_sid off
    php_flag session.cookie_httponly on
</IfModule>

# Lindungi .htaccess
<Files .htaccess>
    Order Allow,Deny
    Deny from all
</Files>

# Lindungi file konfigurasi
<Files "config.php">
    Order Allow,Deny
    Deny from all
</Files>

# Kompresi GZIP
<IfModule mod_deflate.c>
    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
</IfModule>

# Caching
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 2 days"
</IfModule>