Tutorial menghilangkan atau menyembunyikan index.php di CodeIgniter URL SEO Friendly


Tentu menghilangkan, menyembunyikan index.php di URL CodeIgniter membuat URL terlihat lebih rapih di pandang mungkin ^_^, atau pasti lebih SEO Friendly.

Berikut contoh tampilan URL CodeIgniter yang masih ada index.php 
Hapus Index.php URL CodeIgniter
Index.php URL CodeIgniter


Mari kita hilangkan index.php di URL nya, dengan langkah berikut :
  • buat file .htacces root folder yang bersamaan file index.php, dengan struktur file dan folder berikut :
Hapus Index.php URL CodeIgniter
.htaccess CodeIgniter URL
  • Masukan berikut script file .htaccess nya
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
  • Kemudian masuk folder application > config > config.php
Hapus index.php URL CodeIgniter
Config Index.php CodeIgniter

  • Hapus baris index.php di $config[‘index_page’] = ‘’;
  • Silahkan sekarang coba akses URL nya tanpa index.php,  dan berikut gambar hasilnya :
Hapus index.php URL CodeIgniter
URL CodeIgniter SEO Friendly

Okeh, nice kan URL nya, ^_^, okeh semoga bermanfaat, Tutorial cara menghapus index.php di URL CodeIgniter.

Comments