บันทึกการตัด index.php ออกจาก URL ของ Codeigniter เอามาบันทึกไว้ซะเลย เพราะสร้างโปรเจ็คใหม่ทีไร เป็นต้องค้นหาใหม่ทุกที วิธีการก็ง่ายๆ ครับ แต่มีข้อแม้ว่าโฮสที่เราใช้ต้องเปิด mod_rewrite ด้วยนะครับ (ส่วนมากก็เปิดอยู่แล้วครับ) แค่สร้างไฟล์ .htaccess แล้วก็เซฟไว้ที่โฟลเดอร์ของ Codeigniter ที่เราติดตั้งไว้
ไฟล์ .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase / #ตรงนี้ถ้าหากติดตั้ง Codeigniter ไว้ที่โฟลเดอร์ย่อยก็ต้องอ้าง path ให้ถูกด้วยนะครับ เช่น /ci/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
จากนั้นก็เข้าไปแก้ไขไฟล์ {โฟลเดอร์ของCodeiginiter}/system/application/config/config.php ครับ ประมาณบรรทัดที่ 26
จาก
$config['index_page']="index.php";
เป็น
$config['index_page']="";
แค่นี้ก็เรียบร้อยแล้วครับ