how to set base url in codeigniter

Setting Base URL in CodeIgniter

$config['base_url'] = 'http://www.example.com/';
  1. Open the config.php file located in the application/config directory.
  2. Find the line that contains $config['base_url'].
  3. Set the value of $config['base_url'] to the desired base URL, enclosed in single quotes and followed by a trailing slash.
  4. Save the config.php file after making the changes.

This sets the base URL for your CodeIgniter application, allowing you to use the base_url() function and other URL-related functions throughout your application.