CodeIgniter access base_url() inside error_404.php
you might want to use this simple trick. Just change the code below:
<?php echo base_url() ?>
to:
<?php echo config_item(‘base_url’); ?>
credit for https://www.petanikode.com/codeigniter-base-url-404/this work for my case
Try following in application/errors/error_404.php
$CI =& get_instance();if( ! isset($CI)){ $CI = new CI_Controller();}$CI->load->helper('url');echo $CI->base_url();
Try this in top of your 404 page:
$CI =& get_instance();if( ! isset($CI)){ $CI = new CI_Controller();}$CI->load->helper('url');echo base_url();// below here base_url(), site_url() will work
Work for all pages under views/errors/html folder