CakePHP — Fixing Mod Rewrite Issue in Ubuntu

Here we are going to take about how to fix ” Fixing Mod Rewrite Issue” in CakePHP. I’m sure if you have(tried) installed CakePHP in Ubuntu, you definitely would have seen this message.

” URL rewriting is not properly configured on your server.”

And the darn page opens without any css and no URL rewriting (ofcourse, duh!)

Just follow the below checklist, I’m sure you might have missed any one of’em(like i did now ^^”)

Following are the Checklist for Fixing Mod Rewrite Issue

1. Verify all three .htaccess. (yep, three!)




(Important: If you have tried unzip the content of CakePHP source, somehow, .htaccess in ~/projects/cakephp/ got left out… damn!!!)

2. Enable mod rewrite ofcourse! (just double check it :P)

3. Proper permission for /tmp and /webroot

4. Enable “AllowOverride” in Apache

5. Check for `cake.generic.css’ (Seriously, crazy fix!!!)

CakePHP guys showing the URL rewriting issue if the css is not present. sheessh!!! (pss: I’m using CakePHP 1.3, my favorite!!!)

Well,  Thats it for Fixing Mod Rewrite Issue!!!! I’m sure one em will help you fellas or else you will ended up spending hours scratching your head!! xD

Creating Alias Directory for Apache in Windows

Well Ollllo there!!!!

So you have started creating your own project and i guess you’re wondering how to shortcut your project.

(For those who wonders “what is ‘aliasing’ directory”?)

To be short,

let say you have created a project “E:\Program Files\xampp\htdocs\blah\\trunk\myproject\app\”,

so… what do you do to load up in browser “http://localhost/blah/trunk/myproject/”. You might not feel it in the beginning, but as start to become curious (and lazy or wanna be quick), you could do like “http://localhost/myproject”

Ofcourse, you could just put your project directly in htdocs which might makes thing simple, buut… as we create more and more projects, we need to organize or need to use SVN or GIT, and need to follow their folder structure, so, you NEED to shorting things first. Not only it saves time… its cool! 😀

(Lets get started…. )

The example i’m gonna show below is for CakePHP.

1) Find httpd.conf file (must be somewhere here <E:\Program Files\xampp\apache\conf\httpd.conf> or whereever you have installed APACHE)

Find this line,

and change to,

(just removed the comment, i.e ‘#’)

2) Add a new file say, ‘myconfig.conf’ in <E:\Program Files\xampp\apache\conf\proj\myconfig.conf>

(lets keep the config seperate, so you can modify easily)

3) Add the below lines in ‘myconfig.conf’

4) Now, in httpd.conf, add the below line

5) Thats it, restart apache and hit <http://localhost/myproj>, it works!!!! but.. its not over it

6) (This is the step which got my nerve) You see the links (any link on those myproj) looks in unshorten form

Open, <E:/Program Files/xampp/htdocs/blah/trunk/myproj/app/webroot/.htaccess>, it should be like below

Thats all!!! 🙂

For reference, check it out:

If you’re stuck with mod-rewrite, check:

Checkout more about Sublime Text2 here!