62 lines
2.0 KiB
ApacheConf
62 lines
2.0 KiB
ApacheConf
|
|
# Apache URL Rewrite untuk Retribusi Frontend
|
||
|
|
# Opsional: Hanya diperlukan jika ingin clean URLs atau SPA routing
|
||
|
|
|
||
|
|
# Enable rewrite engine
|
||
|
|
<IfModule mod_rewrite.c>
|
||
|
|
RewriteEngine On
|
||
|
|
RewriteBase /
|
||
|
|
|
||
|
|
# Redirect trailing slash (optional)
|
||
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||
|
|
RewriteRule ^(.*)/$ /$1 [R=301,L]
|
||
|
|
|
||
|
|
# Jika ingin clean URLs (tanpa .html), uncomment di bawah:
|
||
|
|
# RewriteCond %{REQUEST_FILENAME} !-f
|
||
|
|
# RewriteCond %{REQUEST_FILENAME} !-d
|
||
|
|
# RewriteRule ^dashboard$ public/dashboard/dashboard.html [L]
|
||
|
|
# RewriteRule ^event$ public/dashboard/event.html [L]
|
||
|
|
# RewriteRule ^settings$ public/dashboard/settings.html [L]
|
||
|
|
|
||
|
|
# Fallback untuk SPA (jika diperlukan di masa depan)
|
||
|
|
# RewriteCond %{REQUEST_FILENAME} !-f
|
||
|
|
# RewriteCond %{REQUEST_FILENAME} !-d
|
||
|
|
# RewriteRule ^(.*)$ index.php [QSA,L]
|
||
|
|
</IfModule>
|
||
|
|
|
||
|
|
# Security headers
|
||
|
|
<IfModule mod_headers.c>
|
||
|
|
# Prevent clickjacking
|
||
|
|
Header set X-Frame-Options "SAMEORIGIN"
|
||
|
|
|
||
|
|
# XSS Protection
|
||
|
|
Header set X-XSS-Protection "1; mode=block"
|
||
|
|
|
||
|
|
# Content Type Options
|
||
|
|
Header set X-Content-Type-Options "nosniff"
|
||
|
|
</IfModule>
|
||
|
|
|
||
|
|
# CORS untuk development (jika diperlukan)
|
||
|
|
# <IfModule mod_headers.c>
|
||
|
|
# Header set Access-Control-Allow-Origin "*"
|
||
|
|
# Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
||
|
|
# Header set Access-Control-Allow-Headers "Content-Type, Authorization, X-API-KEY"
|
||
|
|
# </IfModule>
|
||
|
|
|
||
|
|
# Cache static assets
|
||
|
|
<IfModule mod_expires.c>
|
||
|
|
ExpiresActive On
|
||
|
|
ExpiresByType text/css "access plus 1 year"
|
||
|
|
ExpiresByType application/javascript "access plus 1 year"
|
||
|
|
ExpiresByType image/png "access plus 1 year"
|
||
|
|
ExpiresByType image/jpg "access plus 1 year"
|
||
|
|
ExpiresByType image/jpeg "access plus 1 year"
|
||
|
|
ExpiresByType image/gif "access plus 1 year"
|
||
|
|
ExpiresByType image/svg+xml "access plus 1 year"
|
||
|
|
</IfModule>
|
||
|
|
|
||
|
|
# Gzip compression
|
||
|
|
<IfModule mod_deflate.c>
|
||
|
|
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
|
||
|
|
</IfModule>
|
||
|
|
|