Remove index.php using htaccess

By default, the index.php file will be included in your URLs.
eg : http://localhost/project/index.php/welcome

 

So if you want to remove index.php from url. you have to create .htaccess file in your project. 

eg:

 

If your Apache server has mod_rewrite enabled, you can easily remove this file using a .htaccess file with some simple rules.

Code : Add these lines of code in your .htaccess file


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

</IfModule>

 

In the above example. any HTTP request other than those of existing directories and existing files is treated as a request for your index.php file.


Source Code:

Codeigniter tutorial for beginners

In this project. We are providing you, how to create small project in Codeign....

Source Code