# HRMS - Apache Configuration
php_flag display_errors On
php_flag display_startup_errors On
php_value error_reporting E_ALL
php_flag log_errors On
php_value error_log /home/ljucoid/logs/hris.error.log
# Security: Deny access to sensitive folders
<FilesMatch "\.(sql|md|log|env|ini|json)$">
    Require all denied
</FilesMatch>

# Protect config folder
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Block direct access to sensitive folders
    RewriteRule ^config/ - [F,L]
    RewriteRule ^classes/ - [F,L]
    RewriteRule ^database/ - [F,L]
    RewriteRule ^includes/ - [F,L]

    # Block .htaccess itself
    RewriteRule \.htaccess$ - [F,L]

    # Force HTTPS (uncomment jika sudah production)
    # RewriteCond %{HTTPS} off
    # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/json
</IfModule>

# Cache static assets
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
</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"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# PHP settings
<IfModule mod_php.c>
    php_value upload_max_filesize 10M
    php_value post_max_size 12M
    php_value max_execution_time 60
</IfModule>

# Custom error page
ErrorDocument 403 /includes/403.php
ErrorDocument 404 /includes/404.php

# Prevent directory listing
Options -Indexes