Integrating CakePHP and Joomla

For a website rewrite I am working on I am using Joomla 1.5 with CakePHP 1.2, using the Jake beta bridge (which so far is working great!).

I want to have:

  1. SEO-friendly URLs for Joomla, hence I am running Apache, which I found far easier to configure than IIS. Hence Joomla runs in the webroot.
  2. The Cake application running in a subdirectory of the root (/webapp) which I feel is the cleanest way to separate the two frameworks.
  3. The Cake app tables will sit inside the Joomla database however, which should be fine since the Joomla tables are already prefixed with “jos_”.

It works (almost) out of the box. The one change I ended up having to make was in my webroot .htaccess file, to add a rewrite condition for the special webapp directory:

...
########## Begin - Joomla! core SEF Section
#

# Skip rewrites of anything that is directed at /webapp
RewriteCond %{REQUEST_URI} !^/webapp

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

Leave a Reply

Your email address will not be published. Required fields are marked *