Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

ci base url dynamic

//open folder Application -> config -> config.php
//=============================================
// change $config['base_url'] = ''; code bellow
$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;

// change $config['index_page'] = 'index.php'; code bellow
$config['index_page'] = '';

// change $config['uri_protocol'] = 'PATH_INFO'; code bellow
$config['uri_protocol']	= 'REQUEST_URI';
//=============================================

// inside your folder project ci before floder Application
// create file ".htaccess" then write this code
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 
Source by sekolahkoding.com #
 
PREVIOUS NEXT
Tagged: #ci #base #url #dynamic
ADD COMMENT
Topic
Name
6+2 =