Archive

Posts Tagged ‘mod_rewrite’

Enabling mod_rewrite on Ubuntu

April 18th, 2009

I don’t want to write too much here, since I had a lot to do tonight and I wrote this so that I won’t have to search it all over the internet whenever I had the same case again in the future *giggles*

So, straigth to the problems : I’m using Code Igniter as development framework and i need to remove that annoying “index.php” from the URI. From the CI Wiki I found that the solution is to add a .htaccess file and so on you could read here. But after I tried it, nothing happened. The browser still always displaying 404 Not Found whenever I tried to access any controller without the “index.php”. Seems that my Apache is not enabling mod_rewrite by default then. So after searching I found the solution is like this:

  • Create symlink from /etc/apache2/mods-available/rewrite.so to /etc/apache2/mods-enabled/. Normal symlink creation is OK, but another way to do it is to write

sudo a2enmod rewrite

  • Open /etc/apache2/sites-enabled/000-default and change every AllowOverride None into AllowOverride All below the Document Root. On my case it would becoming like this

DocumentRoot /www/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

  • Lastly … restart apache … you know how …

Back to work then …

Tech Update, Ubuntu Talk, Web Talks, Written in English , ,