About the Post

Author Information

CodeIgniter .htaccess file not working on Mac OS X

If you’re using CodeIgniter on Mac OS X, and you have a .htaccess file that looks something like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]

If you’re finding that it doesn’t seem to be working, and you’re getting 404’s when trying to access any controller other than the front controller, you might want to check on your main httpd.conf file to make sure that you don’t have an AllowOverride None that is preventing your .htaccess directives from being executed.

The main apache configuration file on Leopard is here:

/private/etc/apache2/httpd.conf

Hopefully this saves someone a couple of hours and a couple of Tylenol.

Tags: ,

5 Responses to “CodeIgniter .htaccess file not working on Mac OS X”

  1. Mir #

    Really did save a couple of hours and couple tylenol :)

    thanks

    March 20, 2011 at 12:09 pm
  2. Extremely helpful. Thank you for posting! Saved my night!

    Hamilton

    June 13, 2011 at 9:28 pm
  3. André #

    This is not working.

    i’m using Mac OS X Lion :(

    August 18, 2011 at 2:59 pm
  4. Daniel Wintschel #

    Hey Andre,

    Sorry to hear it – this was a tip for either Leopard or Snow Leopard (can’t remember which) – I haven’t upgraded to Lion yet.

    August 19, 2011 at 12:53 pm
  5. if this is not working then check /private/etc/apache2/users/YOURNAME.conf
    set AllowOverride to All here too

    September 18, 2011 at 5:05 am

Leave a Reply