After installing CakePHP on my Ubuntu box, I viewed the default home page in my browser and noticed that the page was not styled. Cake did not know the path to the CSS file because I had not enabled mod_rewrite. Although I could opt to setup CakePHP to work without mod_rewrite, I decided to enable it.
First I had to make sure that mod_rewrite is enabled on Apache.
sudo a2enmod rewrite
I then had to tell Apache where Cake’s webroot directory is located. I do this in the file ‘/etc/apache2/sites-available/default’, so I opened the file.
sudo pico /etc/apache2/sites-available/default
Note: I use the Pico editor on my Mac, so I tend to use it on Ubuntu as well. You can use whatever editor you are most comfortable using (Nano, gedit, vi, etc).
I added a new rule after the first directory rule:
Save this file and then restart Apache:
sudo /etc/init.d/apache2 force-reload
That’s it. Now when I viewed CakePHP in my browser, the default styling displays correctly.Tags: Apache, CakePHP, CSS, mod_rewrite, Ubuntu
Categories: CakePHP, Ubuntu