Options +FollowSymLinks -MultiViews
RewriteEngine On

# Jika file atau folder asli ditemukan, hentikan proses (jangan di-rewrite)
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# ==========================================
# REWRITE RULES (MENGUBAH URL CANTIK KE PHP)
# ==========================================

# Profile Endpoint Utama
RewriteRule ^profile/?$ editprofile.php [L]

# Kesiswaan, Koordinator, Wali Kelas
RewriteRule ^kesiswaan/laporan/?$ kesiswaan/laporan.php [L]
RewriteRule ^koordinator/laporanabsen/?$ koordinator/laporan.php [L]
RewriteRule ^koordinator/laporanngajar/?$ koordinator/laporanngajar.php [L]
RewriteRule ^wali_kelas/laporan/?$ wali_kelas/laporan.php [L]

# Petugas Piket (Table dan Hapus)
RewriteRule ^petugas_piket/hadir/hapus/([a-zA-Z0-9_.-]+)/?$ petugas_piket/tabelhapushadir.php?id=$1 [L]
RewriteRule ^petugas_piket/(hadir|guru|jamngajar|siswa)/?$ petugas_piket/table$1.php [L]

# Admin: Setting System
RewriteRule ^admin/setting/?$ admin/setting.php [L]
RewriteRule ^admin/settinglaporan/?$ admin/settinglaporan.php [L]

# Admin: Halaman Utama Data Tabel CRUD (Guru, Siswa, Admin, dll.)
RewriteRule ^admin/(admin|guru|siswa|kelas|wali|pelajaran|jamngajar)/?$ admin/table$1.php [L]
RewriteRule ^admin/(admin|guru|siswa|kelas|wali|pelajaran|jamngajar)/add/?$ admin/tambah$1.php [L]
RewriteRule ^admin/(admin|guru|siswa|kelas|wali|pelajaran|jamngajar)/edit/([a-zA-Z0-9_.-]+)/?$ admin/edit$1.php?id=$2 [L]
RewriteRule ^admin/(admin|guru|siswa|kelas|wali|pelajaran|jamngajar)/hapus/([a-zA-Z0-9_.-]+)/?$ admin/tablehapus$1.php?id=$2 [L]
