Tenzin Chemi
Tenzin Chemi

Reputation: 5861

How to remove index.php file from codeigniter

I referred the CodeIgniter Site and also checked various sites for information on how to remove index.php file from Mac OS X 10.10. But still index.php is unavoidable. I need steps to remove index.php from CodeIgniter on Mac OS 10.10.

This is working: localhost/jenny/Learn/index.php/about

This is not working: localhost/jenny/Learn/about

Upvotes: 0

Views: 472

Answers (2)

virendra
virendra

Reputation: 163

open path:/application/config/config.php           
find : $config['index_page']='index.php'        
replace : $config['index_page']=''       

Upvotes: 1

whitwhoa
whitwhoa

Reputation: 2489

As long as you are running apache the operating system should not make a difference in this case.

You need to create a .htaccess file within the your root web directory (this is the directory where the index.php file is located) and within the .htaccess file you will want to include the following:

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

This will allow you to utilize the second url you have posted as it will determine if the requested resource is located within the webroot and if not then redirect to the index.php file without it needing to be included in the url.

If you are not running a different web server then the rewrite rule will be different but the principle is the same. Send all requests to index.php if not resource does not live in web root.

Upvotes: 1

Related Questions