Janith Chinthana Janith Chinthana - 9 months ago 144
PHP Question

Set Dynamic Base Url in CodeIgniter

I need to set dynamic base url in codeigniter due to few following reasons.

  • localhost for development and reset when it goes live

  • single application accessible from multiple domains

  • ip address may change due to dhcp (locally)


CodeIgniter will figure out the base_url by itself, so you can just do:

$config['base_url'] = '';