2025-12-18 13:32:00 +07:00
|
|
|
# Fix Redirect Loop - Masalah di Server Production
|
|
|
|
|
|
|
|
|
|
## Masalah
|
|
|
|
|
|
|
|
|
|
Dari curl test:
|
2025-12-18 13:36:36 +07:00
|
|
|
|
2025-12-18 13:32:00 +07:00
|
|
|
```
|
2025-12-18 13:36:36 +07:00
|
|
|
HTTP/2 302
|
2025-12-18 13:32:00 +07:00
|
|
|
location: ../index.php
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Ada redirect PHP ke `../index.php` yang menyebabkan loop.
|
|
|
|
|
|
|
|
|
|
## Penyebab
|
|
|
|
|
|
|
|
|
|
Kemungkinan besar ada **file PHP di root** atau **konfigurasi server** yang melakukan redirect.
|
|
|
|
|
|
|
|
|
|
## Solusi
|
|
|
|
|
|
|
|
|
|
### 1. Cek File di Root Server
|
|
|
|
|
|
|
|
|
|
Di server production, cek apakah ada file `index.php` di root:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd /www/wwwroot/retribusi.btekno.cloud/retribusi
|
|
|
|
|
ls -la index.php
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Jika ada, **HAPUS** file tersebut karena sekarang `index.php` sudah di folder `public/`.
|
|
|
|
|
|
|
|
|
|
### 2. Cek Konfigurasi Nginx
|
|
|
|
|
|
|
|
|
|
Pastikan document root mengarah ke folder `public/`:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Cek konfigurasi nginx
|
|
|
|
|
cat /etc/nginx/sites-available/retribusi.btekno.cloud
|
|
|
|
|
# atau
|
|
|
|
|
cat /etc/nginx/conf.d/retribusi.conf
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Pastikan ada:
|
2025-12-18 13:36:36 +07:00
|
|
|
|
2025-12-18 13:32:00 +07:00
|
|
|
```nginx
|
|
|
|
|
root /www/wwwroot/retribusi.btekno.cloud/retribusi/public;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**BUKAN**:
|
2025-12-18 13:36:36 +07:00
|
|
|
|
2025-12-18 13:32:00 +07:00
|
|
|
```nginx
|
|
|
|
|
root /www/wwwroot/retribusi.btekno.cloud/retribusi; # SALAH!
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 3. Hapus File index.php di Root (jika ada)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd /www/wwwroot/retribusi.btekno.cloud/retribusi
|
|
|
|
|
rm -f index.php # Hapus jika ada
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 4. Reload Nginx
|
|
|
|
|
|
|
|
|
|
Setelah update konfigurasi:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
nginx -t # Test konfigurasi
|
|
|
|
|
nginx -s reload # Reload nginx
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 5. Test Lagi
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl -I https://retribusi.btekno.cloud/index.php
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Seharusnya sekarang tidak ada redirect 302 lagi.
|
|
|
|
|
|
|
|
|
|
## Checklist
|
|
|
|
|
|
|
|
|
|
- [ ] Tidak ada `index.php` di root `/retribusi/`
|
|
|
|
|
- [ ] Document root nginx mengarah ke `/retribusi/public`
|
|
|
|
|
- [ ] Nginx sudah di-reload
|
|
|
|
|
- [ ] Test curl tidak ada redirect 302
|
|
|
|
|
- [ ] Browser cache sudah di-clear
|