Codeigniter 3 redirection adds index.php to every redirect -


this function in controller

public function delete() {     $result_id =  $this->uri->segment(3);     $this->result_model->delete($result_id);     redirect('results/all/'); } 

function deleting record redirects user

http://localhost/ci/index.php/results/all 

which gives me error 404

my .htaccess this:

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l] 

i have set index_page in config.php

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

removing index.php file in codeigniter

by default, index.php file included in urls:

  example.com/index.php/news/article/my_article 

if apache server has mod_rewrite enabled, can remove file using .htaccess file simple rules. here example of such file, using “negative” method in redirected except specified items:

and set $config['index_page'] = '';

  rewriteengine on   rewritecond %{request_filename} !-f   rewritecond %{request_filename} !-d   rewriterule ^(.*)$ index.php/$1 [l] 

in above example, http request other existing directories , existing files treated request index.php file.

http://www.codeigniter.com/user_guide/general/urls.html


Comments