Enable mod_rewrite on Ubuntu server for CakePHP
To have CakePHP working with pretty URLs, mod_rewrite has to be enabled. The following is a how-to for enabling mod_rewrite for Apach2 on Ubuntu.
System info:
/etc/apache2$ cat /proc/version
Linux version 2.6.24-16-server (buildd@palmer) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Thu Apr 10 13:58:00 UTC 2008
Step 1: Enable mod_rewrite
/etc/apache2$ sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.
Step 2: Enable .htaccess overrides in the directories:
/etc/apache2$ sudo vi sites-available/default
Change AllowOverride from “None” to “All”; it should look like this afterwards:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Step 3: Re-start apache
/etc/apache2$ sudo /etc/init.d/apache2 force-reload
* Reloading web server config apache2 [ OK ]
Apache2 configuration is something new to me. So, this is one of my more interesting moments…