5

This is what my .htaccess looks like. The .htaccess is sitting in /www/scripts directory which is the parent of codeigniter's system directory and which also contains index.php. I have enabled mod_rewrite in my Apache 2.2.x. This is on Ubuntu 9.10 server.

I followed this link, but it does not work. Is there anything I need to do in apache2, any specific configuration so that this works?

RewriteEngine on 
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
Community
  • 1
  • 1
kapso
  • 11,703
  • 16
  • 58
  • 76
  • what happens when you visit your site without index.php? what errors do you get? – Galen May 05 '10 at 03:48
  • 1
    If you *just* enabled mod_rewrite, then you may simply need to restart your server. – kurige May 05 '10 at 04:08
  • Try these links, it may help your question: [http://ellislab.com/forums/viewthread/153950/](http://ellislab.com/forums/viewthread/153950/) [http://ellislab.com/forums/viewthread/153372/](http://ellislab.com/forums/viewthread/153372/) – Jorge Guberte May 05 '10 at 03:55

4 Answers4

8

use this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php/$1 [L]
sonill
  • 548
  • 4
  • 10
  • 21
  • i hope u have enabled mod_rewrite in ur server – sonill May 05 '10 at 04:54
  • yes i have enabled mod_rewrite, i think i made some progress, but now i get this error in apache error log, if .htaccess is enabled "Request exceeded the limit of 10 internal redirects due to probable configuration error" – kapso May 05 '10 at 05:09
  • you might want to check this as corrent answer. it will b easy for other users. – sonill May 05 '10 at 08:40
  • RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d ... means that if the file with the specified name in the browser doesn't exist, or the directory in the browser doesn't exist then procede to the rewrite rule below – Koray Tugay Feb 10 '13 at 18:42
3

Just toss the following code into your .htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Source: http://codeigniter.com/user_guide/general/urls.html

Chris Schmitz
  • 8,097
  • 6
  • 31
  • 41
0

here is the solution simply drop in root.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 
-2

CodeIgniter User Guide on URLs

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
Phil Sturgeon
  • 30,637
  • 12
  • 78
  • 117