.htaccesscodeignitercodeigniter-2codeigniter-url

CodeIgniter Remove index.php in URL


I've created a codeigniter project in Ubuntu system and added following base_url as follows.

http://192.168.1.123/project/

If I access any other url like as follows.

http://192.168.1.123/project/course/view/1

That redirects to 'Page Not Found'. If I include index.php after base_url, Its working fine.

And I created .htaccess file as follows.

RewriteEngine On
RewriteBase /project
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

In config.php file

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

changed to

$config['index_page'] = '';

But still its not working. Please suggest soultion. The work would be appreciated.


Solution

  • change in .htaccess file and try it

    RewriteEngine On
    RewriteBase /project/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]