CakePHP in a subdirectory; no trailing slash

Posted by curt on November 2nd, 2006

I recently worked on a project using the CakePHP web framework. One problem I had was placing the framework in a subdirectory of the main website and accessing the application without a trailing slash:

This worked:
http://mysite.com/sub/

This did not:
http://mysite.com/sub

Usually Apache figures out that "sub" is a directory and will redirect to the slashed location for you. However, CakePHP's default mod_rewrite rules play havoc with this and the result was a 400 Bad Request error. The solution is relatively simple, but was not intuitively easy to figure out.

CakePHP ships with this .htaccess file in the base CakePHP directory:

<IfModule mod_rewrite.c>
  RewriteEngine  on
  RewriteRule ^$  app/webroot/     [L]
  RewriteRule (.*) app/webroot/$1  [L]
</IfModule>

In my attempts to solve this problem, I had tried several rewrite rules and redirects from within this file and from within my website's root web directory (one above the CakePHP directory), but only the following worked for me:

1.) Put this in your website root directory (where "sub" is your CakePHP directory):

<IfModule mod_rewrite.c>
  RewriteEngine  on
  RewriteRule ^sub$       sub/app/webroot/     [L]
  RewriteRule ^sub/(.*)$ sub/app/webroot/$1  [L]
</IfModule>

2) AND, DELETE OR RENAME your .htaccess file in the CakePHP sub directory.

Hope that helps someone.

Flash Player on Linux

Posted by curt on November 2nd, 2006

I've griped before about the lack of Flash Player version 8 or 9 on Linux platforms. Adobe is working on the issue, and significant progress has been made. More encouraging is the Adobe developer blogging about the progress of the project: Penguin SWF.

A beta version of Flash Player 9 for Linux was released on October 18th, and I'm happy to say it works quite well for me. There are still issues for folks on 64bit platforms, but hopefully those will be worked out in time. (It looks like it may be up to the distros to package the necessary 32bit libraries as dependencies).

Even more encouraging is the developer's preference for Gentoo!

Halloween Birthday

Posted by curt on November 2nd, 2006

It just so happens that my birthday falls on Halloween. We took our girls to our church's Fall Festival, where much fun and candy was had. I told my two year old that it was my birthday party. I'm not sure if she believed me.


Copyright © 2007 csummers.org. All rights reserved.