Janith Chinthana Janith Chinthana - 6 months ago 85
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)


Answer

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

$config['base_url'] = '';