One very important change one has to do to the apache configuration file (httpd.conf) to make the URL Rewriting to work is to ensure that the “Options FollowSymLinks” is done for the directory in which CI is installed. Please see the following example (I am running apache on my Mac Snow Leopard and the apache configuration file is at /etc/apache2/httpd.conf)
My CI Installation is in the directory starwood2012
Here is my Directory directive in the httpd.conf (I added this to make the url rewriting work)
<Directory “/Users/Ashok/Sites/starwood2012”>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Further information:
This is the URL that now works:
http://localhost/~Ashok/starwood2012/landing
The equivalent real URL of the above rewritten URL is
http://localhost/~Ashok/starwood2012/index.php/landing
Here is my .htaccess file contents and my .htaccess file is in the directory starwood2012 (The CI Installation directory).
RewriteEngine on
RewriteBase /~Ashok/starwood2012
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
RewriteBase should be everything between your domain name and the controller with NO trailing /
Also ensure that you have $config[‘index_page’] = ‘’; in the application/config/config.php file. You should also have the mod_rewrite enabled (uncomment this line if it is commented in the httpd.conf file - on Mac this enabled by default)
Hope this helps a lot of CodeIgniter users (especially those who work on a Mac)