docs: Add nginx configuration dan fix 404 routing issue

This commit is contained in:
mwpn
2025-12-17 11:00:21 +07:00
parent f829e251a7
commit ef77da97f4
3 changed files with 118 additions and 4 deletions

41
.htaccess Normal file
View File

@@ -0,0 +1,41 @@
# 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>