Hari ini, karena pindah webserver menjadi Apache2 yang sebelumnya menggunakan Nginx, ternyata PyroCMS/CodeIgniter mengalami masalah dengan konfigurasi sebagai berikut:
- Tidak menggunakan Index.php – $config['index_page'] = ”;
- Beberapa URI menggunakan Query String atau $_GET
Solusinya sebagai berikut:
Di /system/…/core/MY_Controller.php, sertakan script berikut pada awal method — function MY_Controller() {….} :
...
function MY_Controller()
{
parent::Controller();
$url = parse_url($_SERVER['REQUEST_URI']);
parse_str($url['query'], $_GET);
parse_str($url['query'], $_REQUEST); // Jika menggunakan $_REQUEST
...
}
...
Untuk .htaccess, isinya sebagai berikut:
<IfModule mod_rewrite.c>
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
RewriteEngine on
# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(system\/cms\/cache|system\/codeigniter|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>
Di Forum PyroCMS atau Codeigniter terdapat kasus dan pemecahan yang berbeda-beda, di atas adalah solusi yang bisa berkerja sebagai solusi permasalah saya. Mudah-mudahan membantu.
Mari kita ngopi, kawan!









