Janith Chinthana Janith Chinthana - 8 months ago 131
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'] = '';