# ----------------------------------------------------------------------
# 1. KONFIGURASI PHP 8.3 (cPanel)
# Menggantikan setting default server agar sesuai dengan Joomla 4/5
# ----------------------------------------------------------------------
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php83___lsphp .php .php8 .phtml
</IfModule>

# ----------------------------------------------------------------------
# 2. KONFIGURASI KEAMANAN & SERVER (Shared Hosting Friendly)
# ----------------------------------------------------------------------

# Mencegah orang melihat daftar file dalam folder (Security)
<IfModule mod_autoindex.c>
  IndexIgnore *
</IfModule>
Options -Indexes

##
# MASALAH ERROR 500 BIASANYA DISINI
# Jika server menolak 'FollowSymLinks', gunakan 'SymLinksIfOwnerMatch'
##
# Options +FollowSymLinks
Options +SymLinksIfOwnerMatch

# ----------------------------------------------------------------------
# 3. JOOMLA CORE SEF SECTION (URL Rewrite)
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
	RewriteEngine On

	##
	# REWRITE BASE
	# Karena diinstall di Subdomain (web.pa-waikabubak.go.id),
	# maka folder tersebut dianggap root (akar). Gunakan tanda garis miring (/)
	##
	RewriteBase /

	##
	# Aturan Standar Joomla
	##
	RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
	
	# Jika request bukan ke index.php
	RewriteCond %{REQUEST_URI} !^/index\.php
	
	# Dan jika file fisik tidak ditemukan
	RewriteCond %{REQUEST_FILENAME} !-f
	
	# Dan jika folder fisik tidak ditemukan
	RewriteCond %{REQUEST_FILENAME} !-d
	
	# Maka alihkan semuanya ke index.php (agar URL cantik jalan)
	RewriteRule .* index.php [L]
</IfModule>

# ----------------------------------------------------------------------
# 4. BLOCK EXPLOITS (Standar Keamanan Joomla)
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
	RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
	RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
	RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
	RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
	RewriteRule .* index.php [F]
</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 178.128.94.119
deny from 91.231.89.97
# Blokir Palo Alto Scanners
deny from 205.210.31.0/24
deny from 198.235.24.0/24
deny from 147.185.132.0/24

# Blokir Penyerang WordPress & Lainnya
deny from 217.216.32.59
deny from 111.221.43.151
deny from 104.199.126.167
