php - CodeIgniter URL suffix .html automatically for all URL -
i new in codeigniter. setup ci in localhost eg. localhost/myprojects/codeigniter/welcome/index
i can able remove index.php url & completed .html suffix so, can able visit localhost/myprojects/codeigniter/welcome/index.html & working properly.
so using tag this:
<a href="<?php echo base_url(); ?>welcome/register.html">register</a>
but, dont want use .html in link manually.
have solution show visitor .html suffix automatically eg. localhost/myprojects/codeigniter/welcome/index.html or localhost/myprojects/codeigniter/welcome/about.html etc
here htaccess http://pastebin.com/cxufjvbp
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 .html echo anchor('welcome/register', 'register'); // <a href="http://domain/welcome/register.html">register</a>
note : dont forget load url helper $this->load->helper('url');
.
Comments
Post a Comment