Akm Sadi
Akm Sadi

Reputation: 304

after removing index.php from url in codeigniter

My login Controller : $this->load->view('login-view');

My link that redirects to 'login-view' is in the template is: anchor('login','Login');

Before removing index.php from url in codeigniter works well. But after removing index.php from url it is not working.

My .htaccess file is :

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

hard to expalin i think, Thats all i have got. :(

Upvotes: 2

Views: 744

Answers (2)

Jamshid Hashimi
Jamshid Hashimi

Reputation: 7823

Just remove index.php from your config file.

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

should be

$config['index_page'] = ""; 

Upvotes: 0

Ahmed Gaber
Ahmed Gaber

Reputation: 708

Try this in .htaccess

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

And in config.php

$config['uri_protocol'] = 'AUTO';

Upvotes: 2

Related Questions