0

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: mysite.com/index.php/home
But this generates 404 errors: mysite.com/home

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.

Thanks!

2
  • Are you able to view the system-wide httpd.con and its included files? It's possible the configuration issue stems from there. Sep 30, 2010 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, 2010 at 5:14

2 Answers 2

0

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).

1
  • 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, 2010 at 16:35
0

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

Deny from all

in your .htaccess works nicely as a testcase.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .