Panduan Asas Pemasangan CodeIgniter


Ini adalah panduan pemasangan CodeIgniter yang paling asas.

Muat turun versi terkini:

  • https://codeigniter.com/download
  • Extract file  CodeIgniter-3.1.9.zip
  • Pindahkan ke folder xampp/htdocs/
  • Rename folder CodeIgniter-3.1.9 dengan nama aplikasi yang diinginkan, contoh: komuniti.
Kandungan fail sistem:

komuniti/
  • application
  • system
  • tests
  • user_guides
  • .editorconfig
  • .gitignore
  • composer.json
  •  contributing.md
  • index.php
  • license.txt
  • readme.rst

Config.php

Base URL:
  • Buka fail config/config.php
  • Gantikan $config['base_url'] = ''; dengan
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

Index File

Padamkan index.php di dalam nilai index_page:

$config['index_page'] = 'index.php';

kepada

$config['index_page'] = '';

.htaccess
  • Bina satu fail baru dengan nama .htaccess 
  • Masukkan kandungan fail seperti di bawah dan simpan
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /komuniti/

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
 
  #SERVER JER: This checks to make sure the connection is not already HTTPS
  #RewriteCond %{HTTPS} !=on
  #RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>

<IfModule !mod_rewrite.c>

  ErrorDocument 404 /index.php
</IfModule>

Layar

Cuba buka sistem anda dengan masukkan URL:

http://localhost/komuniti


Selamat mencuba ;)

Panduan Asas Pemasangan CodeIgniter Panduan Asas Pemasangan CodeIgniter Reviewed by sipolan on December 15, 2018 Rating: 5

No comments

Comments