Skip to content

Instantly share code, notes, and snippets.

@AaEzha
Created June 14, 2021 08:20
Show Gist options
  • Select an option

  • Save AaEzha/65334c7e615a4979177301d6d258423e to your computer and use it in GitHub Desktop.

Select an option

Save AaEzha/65334c7e615a4979177301d6d258423e to your computer and use it in GitHub Desktop.
CodeIgniter 3 - 101
// base url (application/config/config.php)
$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$base_url .= "://". @$_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;
// index.php (application/config/config.php)
$config['index_page'] = '';
// .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
// index.php (line 56)
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment