# ============================================
# XXX DRAGI MAILER - HTACCESS
# ============================================

# Disable directory listing
Options -Indexes

# Çaktivizo mod_security
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_security2.c>
    SecRuleEngine Off
</IfModule>

# Lejo aksesin në PHP
<FilesMatch "\.php$">
    Require all granted
</FilesMatch>

# Lejo aksesin në assets
<FilesMatch "\.(css|js|mp3|png|jpg|jpeg|svg|gif|ico)$">
    Require all granted
</FilesMatch>

# Lejo includes për përdorim të brendshëm
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^logs/ - [F,L]
    RewriteRule ^configs/ - [F,L]
</IfModule>

# PHP Settings - AKTIVIZO GABIMET PËR DEBUG
<IfModule mod_php7.c>
    php_flag display_errors On
    php_flag log_errors On
    php_value error_log logs/php_errors.log
    php_value upload_max_filesize 50M
    php_value post_max_size 50M
    php_value max_execution_time 600
    php_value memory_limit 256M
    php_value max_input_time 600
</IfModule>

<IfModule mod_php.c>
    php_flag display_errors On
    php_flag log_errors On
    php_value error_log logs/php_errors.log
    php_value upload_max_filesize 50M
    php_value post_max_size 50M
    php_value max_execution_time 600
    php_value memory_limit 256M
    php_value max_input_time 600
</IfModule>

# Set default charset
AddDefaultCharset UTF-8

# MIME types
AddType application/javascript js
AddType text/css css

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

# Browser caching
<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 year"
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/svg+xml "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"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "POST, GET, OPTIONS"
    Header set Access-Control-Allow-Headers "Content-Type, X-Requested-With"
</IfModule>