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!
Best Answer
If you are doing this on a .htaccess file, be sure to enable at least,
AllowOverride FileInfo
andOptions 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).