Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove index.php from site_url function in codeigniter

I need to remove index.php from site_url() return value I don't want search engines cache my URLs contain index.php.

I removed index.php from url by setting .htaccess file but still not working.

For example, when I use site_url() in part of my project, search engines cache the URL like http://url/index.php/controller. I remove index.php from site_url function in system/helper but I think the redirect and form_open functions don't work properly.

like image 897
Tolue Admin Avatar asked Mar 28 '15 23:03

Tolue Admin


1 Answers

write in your .htaccess file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

And set index_page config in config.php

$config['index_page'] = '';
like image 56
Muarif Avatar answered Oct 21 '22 05:10

Muarif