Wednesday, November 12, 2008

mod rewrite and virtual hosts (and displaying html in post)

So we are using cakephp, which uses mod rewrite. I am still very new to cakephp, and have mixed feelings.

Anyhow, I spent about an hour trying to figure out why cake php didnt work when we pushed our first version to QA server. So I hope this saves someone an hour.

I narrowed it down to simply mod rewrite was not configured correctly.

Further digging proved that I have to put a 'directory' directive too if I am using virtualhost. That did the trick.
So here is what my working virtualhost looks like:

<virtualhost>
DocumentRoot /usr/local/qa/app/webroot/
ServerName qa.example.com
ErrorLog logs/qa-error_log
CustomLog logs/qa-access_log common
<directory>
AllowOverride All
</directory>
</virtualhost>


As a PS, just in case if wondering: to display html in a post, I replaced <, > with html lt and gt respectively.

No comments: