5ia_iw
Last Updated: February 25, 2016
·
10.19K
· in_explicableme

Remove index.php :: ubuntu help

Hello People,
If you are new in 'codeigniter' and you are linux user then you might face a problem called rewriting which is by default turned off in linux. As a result while developing an application you always need to put 'index.php' in you url(or, uri). Here the solution...

<B>Steps to remove index.php</B>

1.Make below changes in application/config.php file<br>

$config['base_url'] ='http://localhost/Your_Ci_folder_name';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
/*Your server name could be different*/

2.Make .htacces file in your root directory using below code<br>

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

3.Enable rewrite mode (if your rewrite mode is not enabled)

<i>First, initiate it with the following command:</i>

a2enmod rewrite

<i>Edit the file</i>

/etc/apache2/sites-enabled/000-default

change All AllowOverride None to AllowOverride All.

<i>Restart your server with the following command:</i>

sudo /etc/init.d/apache2 restart
Say Thanks
Respond
Filed Under