Remove Index.php from CodeIgniter URL

Everyone when download the CodeIgniter at the first moment he faces the problem of appearing index.php in CodeIgniter URLs.We need to remove index.php from URL so we will get clean URL for our CodeIgniter application and these URLs now will be user and SEO friendly for search engines.So Today In this tutorial we will learn how we can Remove Index.php from CodeIgniter URL.

To work with the urls in the .htaccess file mod_rewrite option must be enabled in the apache server.So go to your apache server httpd.conf and search for the below code.

There will be a # symbol preceding this line remove the # so then mod_rewrite will be enabled.

1-.htaccess Changes

First check if you have .htaccess in your application if it is not there then create a new one and place this below code in your file.

2-Config File Configuration

Now open your config file in this path application/config/config.php and find the below code.

Now change this code with the below code,it means you will remove the index.php.

Thats it now visit your web application like example.com/controller you will see now there is no index.php.If you still facing problems then you have to change your uri_protocol. Find the below code in your config file.

Now change this code with the below code.

Now restart your apache server and check it will be fix.

Conclusion

So today,In this tutorial we’ve learned how to remove index.php from CodeIgniter URL.Now your url will be clean like example.com/controller.If you have any problem regarding removing index.php in CodeIgniter let us know by commenting here.