Codeigniter 2 Pretty URLs

To change Codigniters default setting for urls which current shows http://www.domain.com/index.php to pretty urls like http://www.domain.co.nz/page/contact you need to do two things.

Firstly in the application/config/config.php on line 33 change

$config['index_page'] = 'index.php';
to
$config['index_page'] = '';

  And in the same directory as your main index.php file add a new file .htaccess and add this code

RewriteEngine On
RewriteCond $1 !^(index.php|images|captcha|css|js|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

Copywrite © 2017 Kevin Phillips All rights are reserved.

Proudly supporting opensource software