I have been pulling my hair out for three days, I have googled everything, been on the code igniter forums and checked stack overflow from top to bottom.
All i want to do is remove the index.php from the url's. The closest post I found to my problem was not answered: Post
If i go to localhost/CodeIgniter
my main page is shown. if i click my links i get an error that the page does not exist.
404 Page Not Found
The page you requested was not found.
Based on everything i have read, here is my current configuration.
MAC OSX 10.8.3 MAMP CodeIgniter 2.1.3
My root directory is www/CodeIgniter/ Here is the .htaccess file that is in the CodeIgniter Root
#Deny from all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CodeIgniter/
#Removes access to the 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]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
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
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
Here is the config setup for CodeIgniter: I tried every setting for uri_protocol with no success
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
I verified that I have mod_rewrite enabled and that AllowOverride is set to All in httpd.conf.
****UPDATE so I deleted MAMP and codeigniter and started from scratch. Now with the .htaccess file below, when i go to localhost the codeigniter folder is not shown. If i try to browse to the folder I get the following error.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
when i looked in the error log, i have the following error.
[Mon Apr 22 21:42:51 2013] [alert] [client ::1] /Users/me/Dropbox/www/codeigniter/.htaccess: <IfModule takes one argument, Container for directives based on existance of specified modules
I verified that I have mod_rewrite enabled in my phpinfo();
If i remove the .htaccess file I can browse to the folder and get the main page but of course the links don't work. Any suggestions would be greatly appreciated.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /codeigniter/
#Removes access to the 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]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
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
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>