How to remove index.php from Codeigniter URL?

I would like to explain about removing index.php from codeigniter based application urls with .htaccess.To hide “index.php” from the URL, add an .htaccess file to your web root, with following text:

NOTE: If you are website located in sub directory , instead of ‘RewriteBase / ‘ add ‘RewriteBase /sub directory name ‘.For example if you webiste located in htdocs/ciapp/ then the rule should be RewriteBase /ciapp.

After add .htaccess file go to applications/config/ open config.php, in the config array, remove index_page value

In some cases default settings of uri_protocol doesn’t work properly.To fix this problem just change below code in config.php located at application/config/ directory

By Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.

Leave a Reply

Your email address will not be published. Required fields are marked *