CodeIgniter 404 not found on freshly installed apache2

So I start this morning with freshly installed apache2 on my Ubuntu 11, pulling from bitbucket/Mercurial and suddenly it gave me 404 standard apache2 page.

404 not found

Because my CodeIgniter is a standard no index.php and use .htaccess file to activate the mod_rewrite, so this symptom of problem usually caused by non existing mod_rewrite. So I have to activate mod_rewrite first.


sudo a2enmod rewrite

And then restart apache2 to load the mod


sudo /etc/init.d/apache2 force-reload

Checking on `phpinfo()` it will show mod_rewrite is activated, still 404 error because I haven’t modify the `AllowOverride` settings.

So you have to open file in `/etc/apache2/sites-enabled/000-default` by


sudo nano /etc/apache2/sites-enabled/000-default

(you can use vim, gedit or anything :P)

And change the `AllowOverride None’ into `AllowOverride All`. This will allow `.htaccess` to kick in and override apache2 configurations on your CodeIgniter root.

Refresh the page and voila! my controllers are initalized properly.

Advertisements

One comment

  1. luigi · November 18, 2011

    thank you so much….. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s