Initially, the CodeIgniter Welcome Page comes by default when used the below URL's.
[html]
http://localhost/Codeigniter/
or
http://localhost/Codeigniter/index.php/welcome
[/html]
In the above URL's the second URL doesn't work out if removed
index.php and the result will be as below.
To overcome the problem, index.php have to be removed which involves the following steps.
Step-1: Open the file
config.php
file in the path
application/config. Check for the below code and remove index.php from
$config['index_page'] = '';
[php]
// Find the below code
$config['index_page'] = "index.php";
// Remove index.php and save
$config['index_page'] = "";
[/php]
Step-2: Next go to the root folder of the application and create a file
.htaccess
as shown below.
Step-3: Now enter the below code into Codeigniter htaccess file.
[html]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
[/html]
Step-4: Sometimes in
config.php
file, there will be default setting for
uri_protocol
as
AUTO which does not work properly. To solve the problem replace the line as shown below.
[php]
// Find the below code
$config['uri_protocol'] = "AUTO";
// Edit this line as
$config['uri_protocol'] = "REQUEST_URI" ;
[/php]
Step-5: Now enter the URL
http://localhost/Codeigniter/welcome
and check the output which works fine even after removal of index.php. This is the usage of .htaccess file.