42 lines
1.0 KiB
ApacheConf
42 lines
1.0 KiB
ApacheConf
|
|
# Apache .htaccess untuk Slim Framework 4
|
||
|
|
# Jika menggunakan Apache (bukan nginx)
|
||
|
|
|
||
|
|
<IfModule mod_rewrite.c>
|
||
|
|
RewriteEngine On
|
||
|
|
|
||
|
|
# Redirect to HTTPS (optional)
|
||
|
|
# RewriteCond %{HTTPS} off
|
||
|
|
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||
|
|
|
||
|
|
# Handle Authorization Header
|
||
|
|
RewriteCond %{HTTP:Authorization} .
|
||
|
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||
|
|
|
||
|
|
# Redirect Trailing Slashes
|
||
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||
|
|
RewriteCond %{REQUEST_URI} (.+)/$
|
||
|
|
RewriteRule ^ %1 [L,R=301]
|
||
|
|
|
||
|
|
# Send Requests To Front Controller
|
||
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||
|
|
RewriteRule ^ index.php [L]
|
||
|
|
</IfModule>
|
||
|
|
|
||
|
|
# Security
|
||
|
|
<IfModule mod_headers.c>
|
||
|
|
Header set X-Frame-Options "SAMEORIGIN"
|
||
|
|
Header set X-Content-Type-Options "nosniff"
|
||
|
|
Header set X-XSS-Protection "1; mode=block"
|
||
|
|
</IfModule>
|
||
|
|
|
||
|
|
# Disable directory browsing
|
||
|
|
Options -Indexes
|
||
|
|
|
||
|
|
# Protect .env file
|
||
|
|
<FilesMatch "^\.env">
|
||
|
|
Order allow,deny
|
||
|
|
Deny from all
|
||
|
|
</FilesMatch>
|
||
|
|
|