Posted by: Furqon | 30/07/2010

URL Cantik tanpa index.php di CodeIgniter

Sudah lama tak melakukan koding, sampai lupa buat .htaccess file. Agar tak lupa lagi satu waktu, saya tulis sebagai pengingat.

Buat file berekstensi .htaccess di root folder.

RewriteEngine On
RewriteBase /wisata

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

ErrorDocument 404 /index.php

Kemudian ubah file root/NamaAplikasi/system/application/config/config.php pada baris:
$config['index_page'] = "index.php"; menjadi $config['index_page'] = "";

Satu tambahan untuk mempermudah konfigurasi jika berpindah-pindah host, ubah baris:
menjadi $config['base_url'] = "http://".$_SERVER['HTTP_HOST']."/NamaAplikasi/";

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.