Remove Index.php from URL in PHP CodeIgniter in Fedora 16 server

614 views Asked by At

My web application doesn't work without index.php in URL. It has been working in my previous Laptop (OS: Ubuntu 10.10). In my new laptop, in OS Fedora 16 it doesn't work. I did all the checking like .htaccess, cofig.php etc. Other application rather than CodeIgniter framework like PHPMyAdmin, work fine. Following is my .htaccess code.

# Options
  Options -Multiviews
  Options +FollowSymLinks

 #Enable mod rewrite
 RewriteEngine On
 #the location of the root of your site
#if writing for subdirectories, you would enter /subdirectory
RewriteBase /barj

#Removes access to CodeIgniter system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#This last condition enables access to the images and css
#folders, and the robots.txt file
RewriteCond $1 !^(index\.php|images|robots\.txt|css)

RewriteRule ^(.*)$ index.php?/$1 [L]

in the config.php, I have the following conf

$config['index_page'] = "";
$config['REQUEST_URI']  = "AUTO";

Please give me any idea to resolve the issue.

2

There are 2 answers

3
Kalpesh Patel On

Please check in appache configuration file that mod_rewrite module is enable or not.

You can check it by following command.

echo phpinfo();

If it is not enabled, enable it.

1
Kalpesh Patel On

First try out this minimal code. It is working fine for me.

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

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