-1

I have codeigniter project and I want to upload in local server :192.168.x.xxx.

But I don't know how to change base_url in config file from localhost to local server contain IP address. How to set $config['base_url'] ? Thanks

Regolith
  • 2,944
  • 9
  • 33
  • 50
Apuranic
  • 39
  • 2
  • 9

3 Answers3

0

I would set it some thing like

$config['base_url'] = 'http://localhost/project/';

With domain

$config['base_url'] = 'http://www.yourdomainname.com/';

End base url with /

If you don't set the base url links and css, images etc will not work properly.

  • I set this $config['base_url'] = 'http:// .' $_SERVER['192.168.3.107'] . 'pkl2017/keluhan.php' ; but still error – Apuranic Aug 02 '17 at 03:20
  • Don't use ip address –  Aug 02 '17 at 03:28
  • Also make sure you have named your controllers, models etc correct where only the first letter is upper case only class and filename explained here. https://www.codeigniter.com/user_guide/general/styleguide.html#file-naming –  Aug 02 '17 at 03:30
  • How I set base_url? because that ip address as my website – Apuranic Aug 02 '17 at 06:03
0

try it like this :

index.php :

define('APP_URL', ($_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http') . "://{$_SERVER['SERVER_NAME']}".str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']));

config.php :

$config['base_url'] = APP_URL;

reference : How to set proper codeigniter base url?

Arun pandian M
  • 862
  • 10
  • 17
0

Try like this:

$config['base_url'] = 'http://192.168.3.107/pkl2017';  

NOTE: pkl2017 is your project folder name.

Shihas
  • 814
  • 15
  • 44