Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to remove "index.php" in the CodeIgniter URLs.

I have it working on my Mac (MAMP), but can’t get it working on my Ubuntu (Lucid) hosted server.

This works:
But this generates 404 errors:

I’ve followed the instructions from this post and included the following lines in my .htaccess file.

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
  • I’ve confirmed that mod-rewrite is loaded on Apache2.
  • The .htaccess file is in the webroot (/var/www), which is also where my main index.php is.
  • The .htaccess file permissions are: -rwxrwxr-x
  • I've tried about 20 different posted answers for the .htaccess file, so I suspect there's something wrong with my overall Apache config on my hosted Ubuntu (Lucid) server.

What other Apache configs need to be set to make mod-rewrites work? My httpd.conf file is empty.


share|improve this question
Are you able to view the system-wide httpd.con and its included files? It's possible the configuration issue stems from there. – Johnnie Odom Sep 30 '10 at 4:36
@Johnnie - not sure what you mean. I can "cat /etc/apache2/httpd.conf", but it's empty. That file's permission is: -rw-r--r-- – JMan Sep 30 '10 at 5:14
up vote 0 down vote accepted

If you are doing this on a .htaccess file, be sure to enable at least, AllowOverride FileInfo and Options FollowSymLink to your Apache configuration file.

On the subject of httpd.conf being empty, is just that you are using a Debian based distro, the place you should be looking for is /etc/apache2/sites-available/default (that is the default virtualhost configuration file). Main server directives reside in /etc/apache2/apache2.conf.

(Oh! yes, your test case is working fine).

share|improve this answer
It works great! Thanks! I also needed to restart Apache afterwards. The key was knowing which file was the Apache config file in Ubuntu (not httpd.conf as mentioned in other posts) – JMan Sep 30 '10 at 16:35

Check to see whether AllowOverride is set; a simple, temporary:

Deny from all

in your .htaccess works nicely as a testcase.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.