CodeIgniter URL suffix .html automatically for all URL CodeIgniter URL suffix .html automatically for all URL codeigniter codeigniter

CodeIgniter URL suffix .html automatically for all URL


Just edit url_suffix in config.php .....

$config['url_suffix'] = '.html';

Use site_url()

<!-- No need .html --><a href="<?php echo site_url('welcome/register'); ?>">Register</a><!-- <a href="http://domain/welcome/register.html">Register</a> -->

Or anchor()

// No need .htmlecho anchor('welcome/register', 'Register');// <a href="http://domain/welcome/register.html">Register</a>

Note : Dont forget to load URL helper with $this->load->helper('url');.


Change your config.php file

$config['url_suffix'] = '.html';


Just redefine the base_url function or make a new one. Look at the source of base_url method

function _base_url($path = NULL) {  return base_url() . $path . '.html';}